HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

# H5::EnumType Class Reference

`#include <H5EnumType.h>`

Inheritance diagram for H5::EnumType:

List of all members.

## Public Member Functions
| EnumType (size_t size)
| Creates an empty enumeration datatype given a size, in bytes.
| EnumType (const DataSet &dataset)
| Gets the enum datatype of the specified dataset.
| EnumType (const IntType &data_type)
| Creates a new enum datatype based on an integer datatype.
int | getNmembers () const
| Returns the number of members in this enumeration datatype.
int | getMemberIndex (const char *name) const
| Returns the index of a member in this enumeration datatype.
int | getMemberIndex (const H5std_string &name) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.
void | getMemberValue (unsigned memb_no, void *value) const
| Retrieves the value of a member in this enumeration datatype, given the member's index.
void | insert (const char *name, void *value) const
| Inserts a new member to this enumeration datatype.
void | insert (const H5std_string &name, void *value) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.
H5std_string | nameOf (void *value, size_t size) const
| Returns the symbol name corresponding to a specified member of this enumeration datatype.
void | valueOf (const char *name, void *value) const
| Retrieves the value corresponding to a member of this enumeration datatype, given the member's name.
void | valueOf (const H5std_string &name, void *value) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.
virtual H5std_string | fromClass () const
| EnumType ()
| Default constructor: Creates a stub datatype.
| EnumType (const hid_t existing_id)
| Creates an EnumType object using the id of an existing datatype.
| EnumType (const EnumType &original)
| Copy constructor: makes a copy of the original EnumType object.
virtual | ~EnumType ()
| Properly terminates access to this enum datatype.

## Constructor & Destructor Documentation

H5::EnumType::EnumType | ( | size_t | size | ) |

Creates an empty enumeration datatype given a size, in bytes.

Parameters:

  | size | - IN: Number of bytes in the datatype to create

Exceptions:

  | H5::DataTypeIException |

H5::EnumType::EnumType | ( | const DataSet & | dataset | ) |

Gets the enum datatype of the specified dataset.

Parameters:

  | dataset | - IN: Dataset that this enum datatype associates with

Exceptions:

  | H5::DataTypeIException |

H5::EnumType::EnumType | ( | const IntType & | data_type | ) |

Creates a new enum datatype based on an integer datatype.

Parameters:

  | data_type | - IN: Base datatype

Exceptions:

  | H5::DataTypeIException |

H5::EnumType::EnumType | ( |  | ) |

Default constructor: Creates a stub datatype.

H5::EnumType::EnumType | ( | const hid_t | existing_id | ) |

Creates an EnumType object using the id of an existing datatype.

Parameters:

  | existing_id | - IN: Id of an existing datatype

Exceptions:

  | H5::DataTypeIException |

H5::EnumType::EnumType | ( | const EnumType & | original | ) |

Copy constructor: makes a copy of the original EnumType object.

H5::EnumType::~EnumType | ( |  | ) | `[virtual]`

Properly terminates access to this enum datatype.

## Member Function Documentation

int H5::EnumType::getNmembers | ( |  | ) | const

Returns the number of members in this enumeration datatype.

Returns:
  Number of members

Exceptions:

  | H5::DataTypeIException |

int H5::EnumType::getMemberIndex | ( | const char * | name | ) | const

Returns the index of a member in this enumeration datatype.

Parameters:

  | name | - IN: Name of the queried member

Returns:
  Index of the member if it exists. Index will have the value between 0 and `N-1`, where `N` is the value returned by the member function `EnumType::getNmembers`.

Exceptions:

  | H5::DataTypeIException |

int H5::EnumType::getMemberIndex | ( | const H5std_string & | name | ) | const

This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.

void H5::EnumType::getMemberValue | ( | unsigned | memb_no,
|  | void * | value |
| ) |  |  | const

Retrieves the value of a member in this enumeration datatype, given the member's index.

Parameters:

  | memb_no | - IN: Index of the queried member
  | value | - OUT: Pointer to the retrieved value

Exceptions:

  | H5::DataTypeIException |

void H5::EnumType::insert | ( | const char * | name,
|  | void * | value |
| ) |  |  | const

Inserts a new member to this enumeration datatype.

Parameters:

  | name | - IN: Name of the new member
  | value | - IN: Pointer to the value of the new member

Exceptions:

  | H5::DataTypeIException |

void H5::EnumType::insert | ( | const H5std_string & | name,
|  | void * | value |
| ) |  |  | const

This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.

H5std_string H5::EnumType::nameOf | ( | void * | value,
|  | size_t | size |
| ) |  |  | const

Returns the symbol name corresponding to a specified member of this enumeration datatype.

Parameters:

  | value | - IN: Pointer to the value of the enum datatype
  | size | - IN: Size for the name

Exceptions:

  | H5::DataTypeIException |

void H5::EnumType::valueOf | ( | const char * | name,
|  | void * | value |
| ) |  |  | const

Retrieves the value corresponding to a member of this enumeration datatype, given the member's name.

Parameters:

  | name | - IN: Name of the queried member
  | value | - OUT: Pointer to the retrieved value

Exceptions:

  | H5::DataTypeIException |

void H5::EnumType::valueOf | ( | const H5std_string & | name,
|  | void * | value |
| ) |  |  | const

This is an overloaded member function, provided for convenience. It differs from the above function only in the type of argument name.

virtual H5std_string H5::EnumType::fromClass | ( |  | ) | const`[inline, virtual]`

Reimplemented from H5::DataType.