My Project  1.10.11
H5CompType.h
1 // C++ informative line for the emacs editor: -*- C++ -*-
2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3  * Copyright by The HDF Group. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://www.hdfgroup.org/licenses. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 #ifndef H5CompType_H
15 #define H5CompType_H
16 
17 namespace H5 {
18 
23 // Inheritance: DataType -> H5Object -> H5Location -> IdComponent
24 class H5_DLLCPP CompType : public DataType {
25  public:
26  // Default constructor
27  CompType();
28 
29  // Creates a compound datatype using an existing id
30  CompType(const hid_t existing_id);
31 
32  // Creates a new compound datatype, given the type's size
33  CompType(size_t size); // H5Tcreate
34 
35  // Gets the compound datatype of the specified dataset
36  CompType(const DataSet &dataset); // H5Dget_type
37 
38  // Copy constructor - same as the original CompType.
39  CompType(const CompType &original);
40 
41  // Constructors that open a compound datatype, given a location.
42  CompType(const H5Location &loc, const char *name);
43  CompType(const H5Location &loc, const H5std_string &name);
44 
45  // Returns a CompType object via DataType* by decoding the binary
46  // object description of this type.
47  virtual DataType *decode() const;
48 
49  // Returns the type class of the specified member of this compound
50  // datatype. It provides to the user a way of knowing what type
51  // to create another datatype of the same class
52  H5T_class_t getMemberClass(unsigned member_num) const;
53 
54  // Returns the index of a member in this compound data type.
55  int getMemberIndex(const char *name) const;
56  int getMemberIndex(const H5std_string &name) const;
57 
58  // Returns the offset of a member of this compound datatype.
59  size_t getMemberOffset(unsigned memb_no) const;
60 
61  // Returns the name of a member of this compound datatype.
62  H5std_string getMemberName(unsigned member_num) const;
63 
64  // Returns the generic datatype of the specified member in
65  // this compound datatype.
66  DataType getMemberDataType(unsigned member_num) const;
67 
68  // Returns the array datatype of the specified member in
69  // this compound datatype.
70  ArrayType getMemberArrayType(unsigned member_num) const;
71 
72  // Returns the compound datatype of the specified member in
73  // this compound datatype.
74  CompType getMemberCompType(unsigned member_num) const;
75 
76  // Returns the enumeration datatype of the specified member in
77  // this compound datatype.
78  EnumType getMemberEnumType(unsigned member_num) const;
79 
80  // Returns the integer datatype of the specified member in
81  // this compound datatype.
82  IntType getMemberIntType(unsigned member_num) const;
83 
84  // Returns the floating-point datatype of the specified member in
85  // this compound datatype.
86  FloatType getMemberFloatType(unsigned member_num) const;
87 
88  // Returns the string datatype of the specified member in
89  // this compound datatype.
90  StrType getMemberStrType(unsigned member_num) const;
91 
92  // Returns the variable length datatype of the specified member in
93  // this compound datatype.
94  VarLenType getMemberVarLenType(unsigned member_num) const;
95 
96  // Returns the number of members in this compound datatype.
97  int getNmembers() const;
98 
99  // Adds a new member to this compound datatype.
100  void insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const;
101 
102  // Recursively removes padding from within this compound datatype.
103  void pack() const;
104 
105  // Sets the total size for this compound datatype.
106  void setSize(size_t size) const;
107 
109  virtual H5std_string
110  fromClass() const
111  {
112  return ("CompType");
113  }
114 
115  // Noop destructor.
116  virtual ~CompType();
117 
118  private:
119  // Contains common code that is used by the member functions
120  // getMemberXxxType
121  hid_t p_get_member_type(unsigned member_num) const;
122 
123 }; // end of CompType
124 } // namespace H5
125 
126 #endif // H5CompType_H
H5::CompType::getMemberCompType
CompType getMemberCompType(unsigned member_num) const
Returns the compound datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:338
H5::DataType::getId
virtual hid_t getId() const
Get the id of this datatype.
Definition: H5DataType.cpp:900
H5::IntType
IntType is a derivative of a DataType and operates on HDF5 integer datatype.
Definition: H5IntType.h:24
H5::CompType::decode
virtual DataType * decode() const
Returns a CompType object via DataType* by decoding the binary object description of this datatype.
Definition: H5CompType.cpp:143
H5::CompType::insertMember
void insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const
Inserts a new member to this compound datatype.
Definition: H5CompType.cpp:503
H5::FloatType
FloatType is a derivative of a DataType and operates on HDF5 floating point datatype.
Definition: H5FloatType.h:24
H5::CompType::pack
void pack() const
Recursively removes padding from within a compound datatype.
Definition: H5CompType.cpp:526
H5::DataSet
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:27
H5::CompType::getMemberOffset
size_t getMemberOffset(unsigned memb_no) const
Returns the byte offset of the beginning of a member with respect to the beginning of the compound da...
Definition: H5CompType.cpp:240
H5::CompType::~CompType
virtual ~CompType()
Properly terminates access to this compound datatype.
Definition: H5CompType.cpp:559
H5::DataTypeIException
Definition: H5Exception.h:109
H5::CompType::setSize
void setSize(size_t size) const
Sets the total size for this compound datatype.
Definition: H5CompType.cpp:545
H5::CompType::getMemberFloatType
FloatType getMemberFloatType(unsigned member_num) const
Returns the floating-point datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:404
H5::ArrayType
Class ArrayType inherits from DataType and provides wrappers for the HDF5's Array Datatypes.
Definition: H5ArrayType.h:24
H5::DataSet::getId
virtual hid_t getId() const
Get the id of this dataset.
Definition: H5DataSet.cpp:693
H5::Exception::getDetailMsg
H5std_string getDetailMsg() const
Returns the detailed message set at the time the exception is thrown.
Definition: H5Exception.cpp:264
H5::StrType
StrType is a derivative of a DataType and operates on HDF5 string datatype.
Definition: H5StrType.h:24
H5::CompType::fromClass
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5CompType.h:110
H5::CompType::getMemberName
H5std_string getMemberName(unsigned member_num) const
Returns the name of a member in this compound datatype.
Definition: H5CompType.cpp:184
H5::CompType::getMemberIntType
IntType getMemberIntType(unsigned member_num) const
Returns the integer datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:382
H5::CompType::getMemberIndex
int getMemberIndex(const char *name) const
Returns the index of a member in this compound datatype.
Definition: H5CompType.cpp:210
H5::CompType::getMemberEnumType
EnumType getMemberEnumType(unsigned member_num) const
Returns the enumeration datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:360
H5::CompType::getNmembers
int getNmembers() const
Returns the number of members in this compound datatype.
Definition: H5CompType.cpp:165
H5::CompType::getMemberVarLenType
VarLenType getMemberVarLenType(unsigned member_num) const
Returns the variable length datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:448
H5::VarLenType
VarLenType is a derivative of a DataType and operates on HDF5 Variable-length Datatypes.
Definition: H5VarLenType.h:24
H5::CompType::getMemberStrType
StrType getMemberStrType(unsigned member_num) const
Returns the string datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:426
H5::DataType::f_DataType_setId
friend void f_DataType_setId(DataType *dtype, hid_t new_id)
H5::CompType
CompType is a derivative of a DataType and operates on HDF5 compound datatypes.
Definition: H5CompType.h:24
H5::EnumType
EnumType is a derivative of a DataType and operates on HDF5 enum datatypes.
Definition: H5EnumType.h:24
H5::CompType::getMemberClass
H5T_class_t getMemberClass(unsigned member_num) const
Gets the type class of the specified member.
Definition: H5CompType.cpp:257
H5
Definition: H5AbstractDs.cpp:33
H5::CompType::CompType
CompType()
Default constructor: Creates a stub compound datatype.
Definition: H5CompType.cpp:39
H5::CompType::getMemberArrayType
ArrayType getMemberArrayType(unsigned member_num) const
Returns the array datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:316
H5::DataType
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:27
H5::H5Location
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:30
H5::CompType::getMemberDataType
DataType getMemberDataType(unsigned member_num) const
Returns the generic datatype of the specified member in this compound datatype.
Definition: H5CompType.cpp:294
H5::DataSetIException
Definition: H5Exception.h:130


The HDF Group Help Desk:
  Copyright by The HDF Group