HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

# H5::CompType Class Reference

`#include <H5CompType.h>`

Inheritance diagram for H5::CompType:

List of all members.

## Public Member Functions
| CompType (size_t size)
| Creates an empty compound datatype given a size, in bytes.
| CompType (const DataSet &dataset)
| Gets the compound datatype of the specified dataset.
H5T_class_t | getMemberClass (unsigned member_num) const
| Gets the type class of the specified member.
int | getMemberIndex (const char *name) const
| Returns the index of a member in this compound datatype.
int | getMemberIndex (const H5std_string &name) const
size_t | getMemberOffset (unsigned memb_no) const
| Returns the byte offset of the beginning of a member with respect to the beginning of the compound data type datum.
H5std_string | getMemberName (unsigned member_num) const
| Returns the name of a member in this compound datatype.
DataType | getMemberDataType (unsigned member_num) const
| Returns the generic datatype of the specified member in this compound datatype.
ArrayType | getMemberArrayType (unsigned member_num) const
| Returns the array datatype of the specified member in this compound datatype.
CompType | getMemberCompType (unsigned member_num) const
| Returns the compound datatype of the specified member in this compound datatype.
EnumType | getMemberEnumType (unsigned member_num) const
| Returns the enumeration datatype of the specified member in this compound datatype.
IntType | getMemberIntType (unsigned member_num) const
| Returns the integer datatype of the specified member in this compound datatype.
FloatType | getMemberFloatType (unsigned member_num) const
| Returns the floating-point datatype of the specified member in this compound datatype.
StrType | getMemberStrType (unsigned member_num) const
| Returns the string datatype of the specified member in this compound datatype.
VarLenType | getMemberVarLenType (unsigned member_num) const
| Returns the variable length datatype of the specified member in this compound datatype.
int | getNmembers () const
| Returns the number of members in this compound datatype.
void | insertMember (const H5std_string &name, size_t offset, const DataType &new_member) const
| Inserts a new member to this compound datatype.
void | pack () const
| Recursively removes padding from within a compound datatype.
virtual H5std_string | fromClass () const
| CompType ()
| Default constructor: Creates a stub compound datatype.
| CompType (const hid_t existing_id)
| Creates a CompType object using the id of an existing datatype.
| CompType (const CompType &original)
| Copy constructor: makes copy of the original CompType object.
virtual | ~CompType ()
| Properly terminates access to this compound datatype.

## Detailed Description

Examples:

  compound.cpp.

## Constructor & Destructor Documentation

H5::CompType::CompType | ( | size_t | size | ) |

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

Parameters:

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

Exceptions:

  | H5::DataTypeIException |

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

Gets the compound datatype of the specified dataset.

Parameters:

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

Returns:
  CompType instance

Exceptions:

  | H5::DataTypeIException |

H5::CompType::CompType | ( |  | ) |

Default constructor: Creates a stub compound datatype.

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

Creates a CompType object using the id of an existing datatype.

Parameters:

  | existing_id | - IN: Id of an existing compound datatype

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

Copy constructor: makes copy of the original CompType object.

Parameters:

  | original | - IN: Original CompType instance

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

Properly terminates access to this compound datatype.

## Member Function Documentation

H5T_class_t H5::CompType::getMemberClass | ( | unsigned | member_num | ) | const

Gets the type class of the specified member.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  Type class of the member

Exceptions:

  | H5::DataTypeIException |

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

Returns the index of a member in this compound datatype.

Parameters:

  | name | - IN: Name of the member

Returns:
  Index of member

Exceptions:

  | H5::DataTypeIException |

Description
  Members are stored in no particular order with numbers 0 through N-1, where N is the value returned by the member function `CompType::getNmembers`.

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

size_t H5::CompType::getMemberOffset | ( | unsigned | member_num | ) | const

Returns the byte offset of the beginning of a member with respect to the beginning of the compound data type datum.

Members are stored in no particular order with numbers 0 through N-1, where N is the value returned by the member function `CompType::getNmembers`.

H5std_string H5::CompType::getMemberName | ( | unsigned | member_num | ) | const

Returns the name of a member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  Name of member

Exceptions:

  | H5::DataTypeIException |

DataType H5::CompType::getMemberDataType | ( | unsigned | member_num | ) | const

Returns the generic datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  DataType instance

Exceptions:

  | H5::DataTypeIException |

ArrayType H5::CompType::getMemberArrayType | ( | unsigned | member_num | ) | const

Returns the array datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  ArrayType instance

Exceptions:

  | H5::DataTypeIException |

CompType H5::CompType::getMemberCompType | ( | unsigned | member_num | ) | const

Returns the compound datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  CompType instance

Exceptions:

  | H5::DataTypeIException |

EnumType H5::CompType::getMemberEnumType | ( | unsigned | member_num | ) | const

Returns the enumeration datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  EnumType instance

Exceptions:

  | H5::DataTypeIException |

IntType H5::CompType::getMemberIntType | ( | unsigned | member_num | ) | const

Returns the integer datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  IntType instance

Exceptions:

  | H5::DataTypeIException |

FloatType H5::CompType::getMemberFloatType | ( | unsigned | member_num | ) | const

Returns the floating-point datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  FloatType instance

Exceptions:

  | H5::DataTypeIException |

StrType H5::CompType::getMemberStrType | ( | unsigned | member_num | ) | const

Returns the string datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  StrType instance

Exceptions:

  | H5::DataTypeIException |

VarLenType H5::CompType::getMemberVarLenType | ( | unsigned | member_num | ) | const

Returns the variable length datatype of the specified member in this compound datatype.

Parameters:

  | member_num | - IN: Zero-based index of the member

Returns:
  VarLenType instance

Exceptions:

  | H5::DataTypeIException |

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

Returns the number of members in this compound datatype.

Returns:
  Number of members

Exceptions:

  | H5::DataTypeIException |

void H5::CompType::insertMember | ( | const H5std_string & | name,
|  | size_t | offset,
|  | const DataType & | new_member |
| ) |  |  | const

Inserts a new member to this compound datatype.

Parameters:

  | name | - IN: Name of the new member
  | offset | - IN: Offset in memory structure of the field to insert
  | new_member | - IN: New member to be inserted

Exceptions:

  | H5::DataTypeIException |

void H5::CompType::pack | ( |  | ) | const

Recursively removes padding from within a compound datatype.

Exceptions:

  | H5::DataTypeIException |

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

Reimplemented from H5::DataType.