My Project  1.10.11
H5EnumType.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 H5EnumType_H
15 #define H5EnumType_H
16 
17 namespace H5 {
18 
23 // Inheritance: DataType -> H5Object -> H5Location -> IdComponent
24 class H5_DLLCPP EnumType : public DataType {
25 
26  public:
27  // Creates an empty enumeration datatype based on a native signed
28  // integer type, whose size is given by size.
29  EnumType(size_t size);
30 
31  // Gets the enum datatype of the specified dataset
32  EnumType(const DataSet &dataset); // H5Dget_type
33 
34  // Creates a new enum datatype based on an integer datatype
35  EnumType(const IntType &data_type); // H5Tenum_create
36 
37  // Constructors that open an enum datatype, given a location.
38  EnumType(const H5Location &loc, const char *name);
39  EnumType(const H5Location &loc, const H5std_string &name);
40 
41  // Returns an EnumType object via DataType* by decoding the
42  // binary object description of this type.
43  virtual DataType *decode() const;
44 
45  // Returns the number of members in this enumeration datatype.
46  int getNmembers() const;
47 
48  // Returns the index of a member in this enumeration data type.
49  int getMemberIndex(const char *name) const;
50  int getMemberIndex(const H5std_string &name) const;
51 
52  // Returns the value of an enumeration datatype member
53  void getMemberValue(unsigned memb_no, void *value) const;
54 
55  // Inserts a new member to this enumeration type.
56  void insert(const char *name, void *value) const;
57  void insert(const H5std_string &name, void *value) const;
58 
59  // Returns the symbol name corresponding to a specified member
60  // of this enumeration datatype.
61  H5std_string nameOf(void *value, size_t size) const;
62 
63  // Returns the value corresponding to a specified member of this
64  // enumeration datatype.
65  void valueOf(const char *name, void *value) const;
66  void valueOf(const H5std_string &name, void *value) const;
67 
69  virtual H5std_string
70  fromClass() const
71  {
72  return ("EnumType");
73  }
74 
75  // Default constructor
76  EnumType();
77 
78  // Creates an enumeration datatype using an existing id
79  EnumType(const hid_t existing_id);
80 
81  // Copy constructor: same as the original EnumType.
82  EnumType(const EnumType &original);
83 
84  virtual ~EnumType();
85 
86 }; // end of EnumType
87 } // namespace H5
88 
89 #endif // H5EnumType_H
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::DataSet
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:27
H5::DataTypeIException
Definition: H5Exception.h:109
H5::EnumType::getNmembers
int getNmembers() const
Returns the number of members in this enumeration datatype.
Definition: H5EnumType.cpp:311
H5::EnumType::getMemberIndex
int getMemberIndex(const char *name) const
Returns the index of a member in this enumeration datatype.
Definition: H5EnumType.cpp:281
H5::EnumType::EnumType
EnumType()
Default constructor: Creates a stub datatype.
Definition: H5EnumType.cpp:43
H5::EnumType::~EnumType
virtual ~EnumType()
Properly terminates access to this enum datatype.
Definition: H5EnumType.cpp:345
H5::EnumType::decode
virtual DataType * decode() const
Returns an EnumType object via DataType* by decoding the binary object description of this type.
Definition: H5EnumType.cpp:164
H5::EnumType::insert
void insert(const char *name, void *value) const
Inserts a new member to this enumeration datatype.
Definition: H5EnumType.cpp:187
H5::DataSet::getId
virtual hid_t getId() const
Get the id of this dataset.
Definition: H5DataSet.cpp:693
H5::EnumType::getMemberValue
void getMemberValue(unsigned memb_no, void *value) const
Retrieves the value of a member in this enumeration datatype, given the member's index.
Definition: H5EnumType.cpp:331
H5::EnumType
EnumType is a derivative of a DataType and operates on HDF5 enum datatypes.
Definition: H5EnumType.h:24
H5
Definition: H5AbstractDs.cpp:33
H5::EnumType::valueOf
void valueOf(const char *name, void *value) const
Retrieves the value corresponding to a member of this enumeration datatype, given the member's name.
Definition: H5EnumType.cpp:248
H5::DataType
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:27
H5::EnumType::nameOf
H5std_string nameOf(void *value, size_t size) const
Returns the symbol name corresponding to a specified member of this enumeration datatype.
Definition: H5EnumType.cpp:219
H5::H5Location
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:30
H5::DataSetIException
Definition: H5Exception.h:130
H5::EnumType::fromClass
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5EnumType.h:70


The HDF Group Help Desk:
  Copyright by The HDF Group