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


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois