HDF5 C++ API  1.8.13
 All Classes Namespaces Functions Variables Typedefs Pages
H5EnumType.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 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 __H5EnumType_H
18 #define __H5EnumType_H
19 
20 #ifndef H5_NO_NAMESPACE
21 namespace H5 {
22 #endif
23 
25 class H5_DLLCPP EnumType : public DataType {
26 
27  public:
28  // Creates an empty enumeration datatype based on a native signed
29  // integer type, whose size is given by size.
30  EnumType( size_t size );
31 
32  // Gets the enum datatype of the specified dataset
33  EnumType( const DataSet& dataset ); // H5Dget_type
34 
35  // Creates a new enum datatype based on an integer datatype
36  EnumType( const IntType& data_type ); // H5Tenum_create
37 
38  // Returns the number of members in this enumeration datatype.
39  int getNmembers () const;
40 
41  // Returns the index of a member in this enumeration data type.
42  int getMemberIndex(const char* name) const;
43  int getMemberIndex(const H5std_string& name) const;
44 
45  // Returns the value of an enumeration datatype member
46  void getMemberValue( unsigned memb_no, void *value ) const;
47 
48  // Inserts a new member to this enumeration type.
49  void insert( const char* name, void *value ) const;
50  void insert( const H5std_string& name, void *value ) const;
51 
52  // Returns the symbol name corresponding to a specified member
53  // of this enumeration datatype.
54  H5std_string nameOf( void *value, size_t size ) const;
55 
56  // Returns the value corresponding to a specified member of this
57  // enumeration datatype.
58  void valueOf( const char* name, void *value ) const;
59  void valueOf( const H5std_string& name, void *value ) const;
60 
62  virtual H5std_string fromClass () const { return("EnumType"); }
63 
64  // Default constructor
65  EnumType();
66 
67  // Creates an enumeration datatype using an existing id
68  EnumType( const hid_t existing_id );
69 
70  // Copy constructor: makes a copy of the original EnumType object.
71  EnumType( const EnumType& original );
72 
73  virtual ~EnumType();
74 };
75 #ifndef H5_NO_NAMESPACE
76 }
77 #endif
78 #endif // __H5EnumType_H
Class EnumType operates on HDF5 enum datatypes.
Definition: H5EnumType.h:25
Class IntType operates on HDF5 integer datatype.
Definition: H5IntType.h:25
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:31
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:31
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5EnumType.h:62