HDF5 C++ API  1.8.12
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
H5CompType.h
Go to the documentation of this file.
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 files COPYING and Copyright.html. COPYING can be found at the root *
10  * of the source code distribution tree; Copyright.html can be found at the *
11  * root level of an installed copy of the electronic HDF5 document set and *
12  * is linked from the top-level documents page. It can also be found at *
13  * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
14  * access to either file, you may request a copy from help@hdfgroup.org. *
15  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 #ifndef __H5CompType_H
18 #define __H5CompType_H
19 
20 #ifndef H5_NO_NAMESPACE
21 namespace H5 {
22 #endif
23 
28 class H5_DLLCPP CompType : public DataType {
29  public:
30  // Default constructor
31  CompType();
32 
33  // Creates a compound datatype using an existing id
34  CompType( const hid_t existing_id );
35 
36  // Creates a new compound datatype, given the type's size
37  CompType( size_t size ); // H5Tcreate
38 
39  // Gets the compound datatype of the specified dataset
40  CompType( const DataSet& dataset ); // H5Dget_type
41 
42  // Copy constructor - makes a copy of original object
43  CompType( const CompType& original );
44 
45  // Returns the type class of the specified member of this compound
46  // datatype. It provides to the user a way of knowing what type
47  // to create another datatype of the same class
48  H5T_class_t getMemberClass( unsigned member_num ) const;
49 
50  // Returns the index of a member in this compound data type.
51  int getMemberIndex(const char* name) const;
52  int getMemberIndex(const H5std_string& name) const;
53 
54  // Returns the offset of a member of this compound datatype.
55  size_t getMemberOffset( unsigned memb_no ) const;
56 
57  // Returns the name of a member of this compound datatype.
58  H5std_string getMemberName( unsigned member_num ) const;
59 
60  // Returns the generic datatype of the specified member in
61  // this compound datatype.
62  DataType getMemberDataType( unsigned member_num ) const;
63 
64  // Returns the array datatype of the specified member in
65  // this compound datatype.
66  ArrayType getMemberArrayType( unsigned member_num ) const;
67 
68  // Returns the compound datatype of the specified member in
69  // this compound datatype.
70  CompType getMemberCompType( unsigned member_num ) const;
71 
72  // Returns the enumeration datatype of the specified member in
73  // this compound datatype.
74  EnumType getMemberEnumType( unsigned member_num ) const;
75 
76  // Returns the integer datatype of the specified member in
77  // this compound datatype.
78  IntType getMemberIntType( unsigned member_num ) const;
79 
80  // Returns the floating-point datatype of the specified member in
81  // this compound datatype.
82  FloatType getMemberFloatType( unsigned member_num ) const;
83 
84  // Returns the string datatype of the specified member in
85  // this compound datatype.
86  StrType getMemberStrType( unsigned member_num ) const;
87 
88  // Returns the variable length datatype of the specified member in
89  // this compound datatype.
90  VarLenType getMemberVarLenType( unsigned member_num ) const;
91 
92  // Returns the number of members in this compound datatype.
93  int getNmembers() const;
94 
95  // Adds a new member to this compound datatype.
96  void insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const;
97 
98  // Recursively removes padding from within this compound datatype.
99  void pack() const;
100 
102  virtual H5std_string fromClass () const { return("CompType"); }
103 
104  // Noop destructor.
105  virtual ~CompType();
106 
107  private:
108  // Contains common code that is used by the member functions
109  // getMemberXxxType
110  hid_t p_get_member_type(unsigned member_num) const;
111 };
112 #ifndef H5_NO_NAMESPACE
113 }
114 #endif
115 #endif // __H5CompType_H
CompType is a derivative of a DataType and operates on HDF5 compound datatypes.
Definition: H5CompType.h:28
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:31
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5CompType.h:102
Class EnumType operates on HDF5 enum datatypes.
Definition: H5EnumType.h:25
Class IntType operates on HDF5 integer datatype.
Definition: H5IntType.h:25
Class FloatType operates on HDF5 floating point datatype.
Definition: H5FloatType.h:25
#define H5std_string
Definition: H5Exception.h:29
Class StrType operates on HDF5 string datatypes.
Definition: H5StrType.h:25
VarLenType operates on the HDF5 C's Variable-length Datatypes.
Definition: H5VarLenType.h:28
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:34
Class ArrayType inherits from DataType and provides wrappers for the HDF5's Array Datatypes...
Definition: H5ArrayType.h:28