H5EnumType.h

00001 // C++ informative line for the emacs editor: -*- C++ -*-
00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00003  * Copyright by The HDF Group.                                               *
00004  * Copyright by the Board of Trustees of the University of Illinois.         *
00005  * All rights reserved.                                                      *
00006  *                                                                           *
00007  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00008  * terms governing use, modification, and redistribution, is contained in    *
00009  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00010  * of the source code distribution tree; Copyright.html can be found at the  *
00011  * root level of an installed copy of the electronic HDF5 document set and   *
00012  * is linked from the top-level documents page.  It can also be found at     *
00013  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00014  * access to either file, you may request a copy from help@hdfgroup.org.     *
00015  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00016 
00017 #ifndef _H5EnumType_H
00018 #define _H5EnumType_H
00019 
00020 #ifndef H5_NO_NAMESPACE
00021 namespace H5 {
00022 #endif
00023 
00024 class H5_DLLCPP EnumType : public DataType {
00025 
00026    public:
00027         // Creates an empty enumeration datatype based on a native signed
00028         // integer type, whose size is given by size.
00029         EnumType( size_t size );
00030 
00031         // Gets the enum datatype of the specified dataset
00032         EnumType( const DataSet& dataset );  // H5Dget_type
00033 
00034         // Creates a new enum datatype based on an integer datatype
00035         EnumType( const IntType& data_type );  // H5Tenum_create
00036 
00037         // Returns the number of members in this enumeration datatype.
00038         int getNmembers () const;
00039 
00040         // Returns the index of a member in this enumeration data type.
00041         int getMemberIndex(const char* name) const;
00042         int getMemberIndex(const H5std_string& name) const;
00043 
00044         // Returns the value of an enumeration datatype member
00045         void getMemberValue( unsigned memb_no, void *value ) const;
00046 
00047         // Inserts a new member to this enumeration type.
00048         void insert( const char* name, void *value ) const;
00049         void insert( const H5std_string& name, void *value ) const;
00050 
00051         // Returns the symbol name corresponding to a specified member
00052         // of this enumeration datatype.
00053         H5std_string nameOf( void *value, size_t size ) const;
00054 
00055         // Returns the value corresponding to a specified member of this
00056         // enumeration datatype.
00057         void valueOf( const char* name, void *value ) const;
00058         void valueOf( const H5std_string& name, void *value ) const;
00059 
00061         virtual H5std_string fromClass () const { return("EnumType"); }
00062 
00063         // Default constructor
00064         EnumType();
00065 
00066         // Creates an enumeration datatype using an existing id
00067         EnumType( const hid_t existing_id );
00068 
00069         // Copy constructor: makes a copy of the original EnumType object.
00070         EnumType( const EnumType& original );
00071 
00072         virtual ~EnumType();
00073 };
00074 #ifndef H5_NO_NAMESPACE
00075 }
00076 #endif
00077 #endif