HDF5 C++ API  1.10.1
 All Classes Namespaces Functions Variables Typedefs Friends Pages
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://support.hdfgroup.org/ftp/HDF5/releases. *
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 - makes a copy of original object
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 the type class of the specified member of this compound
47  // datatype. It provides to the user a way of knowing what type
48  // to create another datatype of the same class
49  H5T_class_t getMemberClass(unsigned member_num) const;
50 
51  // Returns the index of a member in this compound data type.
52  int getMemberIndex(const char* name) const;
53  int getMemberIndex(const H5std_string& name) const;
54 
55  // Returns the offset of a member of this compound datatype.
56  size_t getMemberOffset(unsigned memb_no) const;
57 
58  // Returns the name of a member of this compound datatype.
59  H5std_string getMemberName(unsigned member_num) const;
60 
61  // Returns the generic datatype of the specified member in
62  // this compound datatype.
63  DataType getMemberDataType(unsigned member_num) const;
64 
65  // Returns the array datatype of the specified member in
66  // this compound datatype.
67  ArrayType getMemberArrayType(unsigned member_num) const;
68 
69  // Returns the compound datatype of the specified member in
70  // this compound datatype.
71  CompType getMemberCompType(unsigned member_num) const;
72 
73  // Returns the enumeration datatype of the specified member in
74  // this compound datatype.
75  EnumType getMemberEnumType(unsigned member_num) const;
76 
77  // Returns the integer datatype of the specified member in
78  // this compound datatype.
79  IntType getMemberIntType(unsigned member_num) const;
80 
81  // Returns the floating-point datatype of the specified member in
82  // this compound datatype.
83  FloatType getMemberFloatType(unsigned member_num) const;
84 
85  // Returns the string datatype of the specified member in
86  // this compound datatype.
87  StrType getMemberStrType(unsigned member_num) const;
88 
89  // Returns the variable length datatype of the specified member in
90  // this compound datatype.
91  VarLenType getMemberVarLenType(unsigned member_num) const;
92 
93  // Returns the number of members in this compound datatype.
94  int getNmembers() const;
95 
96  // Adds a new member to this compound datatype.
97  void insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const;
98 
99  // Recursively removes padding from within this compound datatype.
100  void pack() const;
101 
102  // Sets the total size for this compound datatype.
103  void setSize(size_t size) const;
104 
106  virtual H5std_string fromClass () const { return("CompType"); }
107 
108  // Noop destructor.
109  virtual ~CompType();
110 
111  private:
112  // Contains common code that is used by the member functions
113  // getMemberXxxType
114  hid_t p_get_member_type(unsigned member_num) const;
115 
116 }; // end of CompType
117 } // namespace H5
118 
119 #endif // __H5CompType_H
EnumType is derived from a DataType and operates on HDF5 enum datatypes.
Definition: H5EnumType.h:25
IntType is derived from a DataType and operates on HDF5 integer datatype.
Definition: H5IntType.h:25
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:36
VarLenType is derived from a DataType and operates on HDF5 C's Variable-length Datatypes.
Definition: H5VarLenType.h:25
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:28
Class ArrayType inherits from DataType and provides wrappers for the HDF5's Array Datatypes...
Definition: H5ArrayType.h:25
FloatType is a derivative of a DataType and operates on HDF5 floating point datatype.
Definition: H5FloatType.h:25
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5CompType.h:106
StrType is derived from a DataType and operates on HDF5 string datatype.
Definition: H5StrType.h:25
CompType is a derivative of a DataType and operates on HDF5 compound datatypes.
Definition: H5CompType.h:25


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