HDF5 Reference Manual H5 H5A H5D H5E H5F H5G H5P H5S H5T H5Z Tools

# H5T: Datatype Interface

## Datatype Object API Functions

These functions create and manipulate the datatype which describes elements of a dataset.

General Datatype Operations
- H5Tcreate
- H5Topen
- H5Tcommit
- H5Tcommitted
- H5Tcopy
- H5Tequal
- H5Tlock
- H5Tclose

  Atomic Datatype Properties

- H5Tget_class
- H5Tget_size
- H5Tset_size
- H5Tget_order
- H5Tset_order
- H5Tget_precision
- H5Tset_precision
- H5Tget_offset
- H5Tset_offset

- H5Tget_pad
- H5Tset_pad
- H5Tget_sign
- H5Tset_sign
- H5Tget_fields
- H5Tset_fields
- H5Tget_ebias
- H5Tset_ebias
- H5Tget_norm
- H5Tset_norm
- H5Tget_inpad
- H5Tset_inpad
- H5Tget_cset
- H5Tset_cset
- H5Tget_strpad
- H5Tset_strpad

  Properties of Compound Types

- H5Tget_class
- H5Tget_size

- H5Tget_nmembers
- H5Tget_member_name
- H5Tget_member_offset
- H5Tget_member_dims
- H5Tget_member_type
- H5Tinsert
- H5Tpack
- H5Tinsert_array

  Conversion Functions

- H5Tconvert
- H5Tfind
- H5Tset_overflow
- H5Tget_overflow
- H5Tregister_hard
- H5Tregister_soft
- H5Tunregister

The Datatype interface, H5T, provides a mechanism to describe the storage format of individual data points of a data set and is hopefully designed in such a way as to allow new features to be easily added without disrupting applications that use the data type interface. A dataset (the H5D interface) is composed of a collection or raw data points of homogeneous type organized according to the data space (the H5S interface).

A datatype is a collection of datatype properties, all of which can be stored on disk, and which when taken as a whole, provide complete information for data conversion to or from that datatype. The interface provides functions to set and query properties of a datatype.

A data point is an instance of a datatype, which is an instance of a type class. We have defined a set of type classes and properties which can be extended at a later time. The atomic type classes are those which describe types which cannot be decomposed at the datatype interface level; all other classes are compound.

See The Datatype Interface (H5T) in the HDF5 User's Guide for further information, including a complete list of all supported datatypes.

Name: H5Topen
Signature:
  hid_t `H5Topen`(hid_t `loc_id`, const char * `name` )
Purpose:
  Opens a named datatype.
Description:
  `H5Topen` opens a named datatype at the location specified by `loc_id` and returns an identifier for the datatype. `loc_id` is either a file or group identifier. The identifier should eventually be closed by calling `H5Tclose()` to release resources.
Parameters:

hid_t `loc_id`
  A file, group, or datatype identifier.
const char * `name`
  A datatype name.

Returns:
  Returns a named datatype identifier if successful; otherwise FAIL (-1).

Name: H5Tcommit
Signature:
  herr_t `H5Tcommit`(hid_t `loc_id`, const char * `name`, hid_t `type` )
Purpose:
  Commits a transient datatype to a file, creating a new named datatype.
Description:
  `H5Tcommit` commits a transient datatype (not immutable) to a file, turned it into a named datatype. The `loc_id` is either a file or group identifier which, when combined with `name`, refers to a new named datatype.
Parameters:

hid_t `loc_id`
  A file or group identifier.
const char * `name`
  A datatype name.
hid_t `type`
  A datatype identifier.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tcommitted
Signature:
  hbool_t `H5Tcommitted`(hid_t `type`)
Purpose:
  Determines whether a datatype is a named type or a transient type.
Description:
  `H5Tcommitted` queries a type to determine whether the type specified by the `type` identifier is a named type or a transient type. If this function returns a positive value, then the type is named (that is, it has been committed, perhaps by some other application). Datasets which return committed datatypes with `H5Dget_type()` are able to share the datatype with other datasets in the same file.
Parameters:

hid_t `type`
  Datatype identifier.

Returns:
  The successful return values are TRUE if committed, else FALSE. Otherwise returns FAIL (-1).

Name: H5Tinsert_array
Signature:
  herr_t `H5Tinsert_array`(hid_t `parent_id`, const char *`name`, size_t `offset`, int `ndims`, const size_t *`dim`, const int *`perm`, hid_t `member_id` )
Purpose:
  Adds an array member to a compound datatype.
Description:
  `H5Tinsert_array` adds a new member to the compound datatype `parent_id`. The member is an array with `ndims` dimensionality and the size of the array is `dim`. The new member's name, `name`, must be unique within the compound datatype. The `offset` argument defines the start of the member in an instance of the compound datatype and `member_id` is the type identifier of the new member. The total member size should be relatively small.
Parameters:

hid_t `parent_id`
  Identifier of the parent compound datatype.
const char *`name`
  Name of new member.
size_t `offset`
  Offset to start of new member within compound datatype.
int `ndims`
  Dimensionality of new member.
const size_t *`dim`
  Size of new member array.
const int *`perm`
  Pointer to buffer to store the permutation vector of the field.
hid_t `member_id`
  Identifier of the datatype of the new member.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tfind
Signature:
  H5T_conv_t `H5Tfind`(hid_t `src_id`, hid_t `dst_id`, H5T_cdata_t **`pcdata` )
Purpose:
  Finds a conversion function.
Description:
  `H5Tfind` finds a conversion function that can handle a conversion from type `src_id` to type `dst_id`. The `pcdata` argument is a pointer to a pointer to type conversion data which was created and initialized by the soft type conversion function of this path when the conversion function was installed on the path.
Parameters:

hid_t `src_id`
  Identifier for the source datatype.
hid_t `dst_id`
  Identifier for the destination datatype.
H5T_cdata_t **`pcdata`
  Pointer to type conversion data.

Returns:
  Returns a pointer to a suitable conversion function if successful. Otherwise returns NULL.

Name: H5Tconvert
Signature:
  herr_t `H5Tconvert`(hid_t `src_id`, hid_t `dst_id`, size_t `nelmts`, void *`buf`, void *`background` )
Purpose:
  Converts data from between specified datatypes.
Description:
  `H5Tconvert` converts `nelmts` elements from the type specified by the `src_id` identifier to type `dst_id`. The source elements are packed in `buf` and on return the destination will be packed in `buf`. That is, the conversion is performed in place. The optional background buffer is an array of `nelmts` values of destination type which are merged with the converted values to fill in cracks (for instance, `background` might be an array of structs with the `a` and `b` fields already initialized and the conversion of `buf` supplies the `c` and `d` field values).
Parameters:

hid_t `src_id`
  Identifier for the source datatype.
hid_t `dst_id`
  Identifier for the destination datatype.
size_t `nelmts`
  Size of array `buf`.
void *`buf`
  Array containing pre- and post-conversion values.
void *`background`
  Optional background buffer.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tset_overflow
Signature:
  herr_t `H5Tset_overflow`(H5T_overflow_t `func`)
Purpose:
  Sets the overflow handler to a specified function.
Description:
  `H5Tset_overflow` sets the overflow handler to be the function specified by `func`. `func` will be called for all datatype conversions that result in an overflow.

  See the definition of `H5T_overflow_t` in `H5Tpublic.h` for documentation of arguments and return values. The prototype for `H5T_overflow_t` is as follows:
  `herr_t (*H5T_overflow_t)(hid_t src_id, hid_t dst_id, void *src_buf, void *dst_buf);`

  The NULL pointer may be passed to remove the overflow handler.

Parameters:

H5T_overflow_t `func`
  Overflow function.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_overflow
Signature: H5Tget_overflow ()
  H5T_overflow_t `H5Tget_overflow`(`void`)
Purpose:
  Returns a pointer to the current global overflow function.
Description:
  `H5Tset_overflow` returns a pointer to the current global overflow function. This is an application-defined function that is called whenever a datatype conversion causes an overflow.
Parameters:

None.

Returns:
  Returns a pointer to an application-defined function if successful. Otherwise returns NULL; this can happen if no overflow handling function is registered.

Name: H5Tcreate
Signature:
  hid_t `H5Tcreate`(H5T_class_t `class`, size_t `size` )
Purpose:
  Creates a new dataype.
Description:
  `H5Tcreate` creates a new dataype of the specified class with the specified number of bytes. Currently, only the `H5T_COMPOUND` datatype class is supported with this function. Use `H5Tcopy` to create integer or floating-point datatypes. The datatype identifier returned from this function should be released with `H5Tclose` or resource leaks will result.
Parameters:

H5T_class_t `class`
  Class of datatype to create.
size_t `size`
  The number of bytes in the datatype to create.

Returns:
  Returns datatype identifier if successful; otherwise FAIL (-1).

Name: H5Tcopy
Signature:
  hid_t `H5Tcopy`(hid_t `type_id`)
Purpose:
  Copies an existing datatype.
Description:
  `H5Tcopy` copies an existing datatype. The returned type is always transient and unlocked.

  The `type_id` argument can be either a datatype identifier, a predefined datatype (defined in `H5Tpublic.h`), or a dataset identifier. If `type_id` is a dataset identifier instead of a datatype identifier, then this function returns a transient, modifiable datatype which is a copy of the dataset's datatype.

  The datatype identifier returned should be released with `H5Tclose` or resource leaks will occur.

Parameters:

hid_t `type_id`
  Identifier of datatype to copy. Can be a datatype identifier, a predefined datatype (defined in `H5Tpublic.h`), or a dataset identifier.

Returns:
  Returns a datatype identifier if successful; otherwise FAIL (-1)

Name: H5Tequal
Signature:
  hbool_t `H5Tequal`(hid_t `type_id1`, hid_t `type_id2` )
Purpose:
  Determines whether two datatype identifiers refer to the same datatype.
Description:
  `H5Tequal` determines whether two datatype identifiers refer to the same datatype.
Parameters:

hid_t `type_id1`
  Identifier of datatype to compare.
hid_t `type_id2`
  Identifier of datatype to compare.

Returns:
  When successful, returns TRUE if the datatype identifiers refer to the same datatype, else FALSE. Otherwise returns FAIL (-1).

Name: H5Tlock
Signature:
  herr_t `H5Tlock`(hid_t `type_id` )
Purpose:
  Locks a datatype.
Description:
  `H5Tlock` locks the datatype specified by the `type_id` identifier, making it read-only and non-destrucible. This is normally done by the library for predefined datatypes so the application does not inadvertently change or delete a predefined type. Once a datatype is locked it can never be unlocked.
Parameters:

hid_t `type_id`
  Identifier of datatype to lock.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_class
Signature:
  H5T_class_t `H5Tget_class`(hid_t `type_id` )
Purpose:
  Returns the datatype class identifier.
Description:
  `H5Tget_class` returns the datatype class identifier.

  Valid class identifiers, as defined in `H5Tpublic.h`, are:

  - `H5T_INTEGER` (`0`)
  - `H5T_FLOAT` (`1`)
  - `H5T_TIME` (`2`)
  - `H5T_STRING` (`3`)
  - `H5T_BITFIELD` (`4`)
  - `H5T_OPAQUE` (`5`)
  - `H5T_COMPOUND` (`6`)
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns datatype class identifier if successful; otherwise H5T_NO_CLASS (-1).

Name: H5Tget_size
Signature:
  size_t `H5Tget_size`(hid_t `type_id` )
Purpose:
  Returns the size of a datatype.
Description:
  `H5Tget_size` returns the size of a datatype in bytes.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns the size of the datatype in bytes if successful; otherwise 0.

Name: H5Tset_size
Signature:
  herr_t `H5Tset_size`(hid_t `type_id`, size_t `size` )
Purpose:
  Sets the total size for an atomic datatype.
Description:
  `H5Tset_size` sets the total size in bytes, `size`, for an atomic datatype (this operation is not permitted on compound datatypes). If the size is decreased so that the significant bits of the datatype extend beyond the edge of the new size, then the `offset' property is decreased toward zero. If the `offset' becomes zero and the significant bits of the datatype still hang over the edge of the new size, then the number of significant bits is decreased. Adjusting the size of an H5T_STRING automatically sets the precision to 8*size. All datatypes have a positive size.
Parameters:

hid_t `type_id`
  Identifier of datatype to change size.
size_t `size`
  Size in bytes to modify datatype.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_order
Signature:
  H5T_order_t `H5Tget_order`(hid_t `type_id` )
Purpose:
  Returns the byte order of an atomic datatype.
Description:
  `H5Tget_order` returns the byte order of an atomic datatype.

  Possible return values are:

  `H5T_ORDER_LE` (`0`)
    Little endian byte ordering (default).
  `H5T_ORDER_BE` (`1`)
    Big endian byte ordering.
  `H5T_ORDER_VAX` (`2`)
    VAX mixed byte ordering (not currently supported).
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a byte order constant if successful; otherwise `H5T_ORDER_ERROR` (-1).

Name: H5Tset_order
Signature:
  herr_t `H5Tset_order`(hid_t `type_id`, H5T_order_t `order` )
Purpose:
  Sets the byte ordering of an atomic datatype.
Description:
  `H5Tset_order` sets the byte ordering of an atomic datatype. Byte orderings currently supported are:
  H5T_ORDER_LE (`0`)
    Little-endian byte ordering (default).
  H5T_ORDER_BE (`1`)
    Big-endian byte ordering.
  H5T_ORDER_VAX (`2`)
    VAX mixed byte ordering (not currently supported).
Parameters:

hid_t `type_id`
  Identifier of datatype to set.
H5T_order_t `order`
  Byte ordering constant.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_precision
Signature:
  size_t `H5Tget_precision`(hid_t `type_id` )
Purpose:
  Returns the precision of an atomic datatype.
Description:
  `H5Tget_precision` returns the precision of an atomic datatype. The precision is the number of significant bits which, unless padding is present, is 8 times larger than the value returned by H5Tget_size().
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns the number of significant bits if successful; otherwise 0.

Name: H5Tset_precision
Signature:
  herr_t `H5Tset_precision`(hid_t `type_id`, size_t `precision` )
Purpose:
  Sets the precision of an atomic datatype.
Description:
  `H5Tset_precision` sets the precision of an atomic datatype. The precision is the number of significant bits which, unless padding is present, is 8 times larger than the value returned by H5Tget_size().

  If the precision is increased then the offset is decreased and then the size is increased to insure that significant bits do not "hang over" the edge of the datatype.

  Changing the precision of an H5T_STRING automatically changes the size as well. The precision must be a multiple of 8.

  When decreasing the precision of a floating point type, set the locations and sizes of the sign, mantissa, and exponent fields first.

Parameters:

hid_t `type_id`
  Identifier of datatype to set.
size_t `precision`
  Number of bits of precision for datatype.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_offset
Signature:
  size_t `H5Tget_offset`(hid_t `type_id` )
Purpose:
  Retrieves the bit offset of the first significant bit.
Description:
  `H5Tget_offset` retrieves the bit offset of the first significant bit. The signficant bits of an atomic datum can be offset from the beginning of the memory for that datum by an amount of padding. The `offset' property specifies the number of bits of padding that appear to the "right of" the value. That is, if we have a 32-bit datum with 16-bits of precision having the value 0x1122 then it will be layed out in memory as (from small byte address toward larger byte addresses):

  Byte Position | Big-Endian Offset=0 | Big-Endian Offset=16 | Little-Endian Offset=0 | Little-Endian Offset=16
  --- | --- | --- | --- | ---
  0: | [ pad] | [0x11] | [0x22] | [ pad]
  1: | [ pad] | [0x22] | [0x11] | [ pad]
  2: | [0x11] | [ pad] | [ pad] | [0x22]
  3: | [0x22] | [ pad] | [ pad] | [0x11]

Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a positive offset value if successful; otherwise 0.

Name: H5Tset_offset
Signature:
  herr_t `H5Tset_offset`(hid_t `type_id`, size_t `offset` )
Purpose:
  Sets the bit offset of the first significant bit.
Description:
  `H5Tset_offset` sets the bit offset of the first significant bit. The signficant bits of an atomic datum can be offset from the beginning of the memory for that datum by an amount of padding. The `offset' property specifies the number of bits of padding that appear to the "right of" the value. That is, if we have a 32-bit datum with 16-bits of precision having the value 0x1122 then it will be layed out in memory as (from small byte address toward larger byte addresses):

  Byte Position | Big-Endian Offset=0 | Big-Endian Offset=16 | Little-Endian Offset=0 | Little-Endian Offset=16
  --- | --- | --- | --- | ---
  0: | [ pad] | [0x11] | [0x22] | [ pad]
  1: | [ pad] | [0x22] | [0x11] | [ pad]
  2: | [0x11] | [ pad] | [ pad] | [0x22]
  3: | [0x22] | [ pad] | [ pad] | [0x11]

  If the offset is incremented then the total size is incremented also if necessary to prevent significant bits of the value from hanging over the edge of the datatype.

  The offset of an H5T_STRING cannot be set to anything but zero.

Parameters:

hid_t `type_id`
  Identifier of datatype to set.
size_t `offset`
  Offset of first significant bit.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_pad
Signature:
  herr_t `H5Tget_pad`(hid_t `type_id`, H5T_pad_t * `lsb`, H5T_pad_t * `msb` )
Purpose:
  Retrieves the padding type of the least and most-significant bit padding.
Description:
  `H5Tget_pad` retrieves the padding type of the least and most-significant bit padding. Valid types are:
  H5T_PAD_ZERO (`0`)
    Set background to zeros.
  H5T_PAD_ONE (`1`)
    Set background to ones.
  H5T_PAD_BACKGROUND (`2`)
    Leave background alone.
Parameters:

hid_t `type_id`
  IN: Identifier of datatype to query.
H5T_pad_t * `lsb`
  OUT: Pointer to location to return least-significant bit padding type.
H5T_pad_t * `msb`
  OUT: Pointer to location to return most-significant bit padding type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tset_pad
Signature:
  herr_t `H5Tset_pad`(hid_t `type_id`, H5T_pad_t `lsb`, H5T_pad_t `msb` )
Purpose:
  Sets the least and most-significant bits padding types.
Description:
  `H5Tset_pad` sets the least and most-significant bits padding types.
  H5T_PAD_ZERO (`0`)
    Set background to zeros.
  H5T_PAD_ONE (`1`)
    Set background to ones.
  H5T_PAD_BACKGROUND (`2`)
    Leave background alone.
Parameters:

hid_t `type_id`
  Identifier of datatype to set.
H5T_pad_t `lsb`
  Padding type for least-significant bits.
H5T_pad_t `msb`
  Padding type for most-significant bits.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_sign
Signature:
  H5T_sign_t `H5Tget_sign`(hid_t `type_id` )
Purpose:
  Retrieves the sign type for an integer type.
Description:
  `H5Tget_sign` retrieves the sign type for an integer type. Valid types are:
  H5T_SGN_NONE (`0`)
    Unsigned integer type.
  H5T_SGN_2 (`1`)
    Two's complement signed integer type.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a valid sign type if successful; otherwise `H5T_SGN_ERROR` (-1).

Name: H5Tset_sign
Signature:
  herr_t `H5Tset_sign`(hid_t `type_id`, H5T_sign_t `sign` )
Purpose:
  Sets the sign proprety for an integer type.
Description:
  `H5Tset_sign` sets the sign proprety for an integer type.
  H5T_SGN_NONE (`0`)
    Unsigned integer type.
  H5T_SGN_2 (`1`)
    Two's complement signed integer type.
Parameters:

hid_t `type_id`
  Identifier of datatype to set.
H5T_sign_t `sign`
  Sign type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_fields
Signature:
  herr_t `H5Tget_fields`(hid_t `type_id`, size_t * `epos`, size_t * `esize`, size_t * `mpos`, size_t * `msize` )
Purpose:
  Retrieves floating point datatype bit field information.
Description:
  `H5Tget_fields` retrieves information about the locations of the various bit fields of a floating point datatype. The field positions are bit positions in the significant region of the datatype. Bits are numbered with the least significant bit number zero. Any (or even all) of the arguments can be null pointers.
Parameters:

hid_t `type_id`
  IN: Identifier of datatype to query.
size_t * `epos`
  OUT: Pointer to location to return exponent bit-position.
size_t * `esize`
  OUT: Pointer to location to return size of exponent in bits.
size_t * `mpos`
  OUT: Pointer to location to return mantissa bit-position.
size_t * `msize`
  OUT: Pointer to location to return size of mantissa in bits.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tset_fields
Signature:
  herr_t `H5Tset_fields`(hid_t `type_id`, size_t `epos`, size_t `esize`, size_t `mpos`, size_t `msize` )
Purpose:
  Sets locations and sizes of floating point bit fields.
Description:
  `H5Tset_fields` sets the locations and sizes of the various floating point bit fields. The field positions are bit positions in the significant region of the datatype. Bits are numbered with the least significant bit number zero.

  Fields are not allowed to extend beyond the number of bits of precision, nor are they allowed to overlap with one another.

Parameters:

hid_t `type_id`
  Identifier of datatype to set.
size_t `epos`
  Exponent bit position.
size_t `esize`
  Size of exponent in bits.
size_t `mpos`
  Mantissa bit position.
size_t `msize`
  Size of mantissa in bits.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_ebias
Signature:
  size_t `H5Tget_ebias`(hid_t `type_id` )
Purpose:
  Retrieves the exponent bias of a floating-point type.
Description:
  `H5Tget_ebias` retrieves the exponent bias of a floating-point type.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns the bias if successful; otherwise 0.

Name: H5Tset_ebias
Signature:
  herr_t `H5Tset_ebias`(hid_t `type_id`, size_t `ebias` )
Purpose:
  Sets the exponent bias of a floating-point type.
Description:
  `H5Tset_ebias` sets the exponent bias of a floating-point type.
Parameters:

hid_t `type_id`
  Identifier of datatype to set.
size_t `ebias`
  Exponent bias value.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_norm
Signature:
  H5T_norm_t `H5Tget_norm`(hid_t `type_id` )
Purpose:
  Retrieves mantissa normalization of a floating-point datatype.
Description:
  `H5Tget_norm` retrieves the mantissa normalization of a floating-point datatype. Valid normalization types are:
  H5T_NORM_IMPLIED (`0`)
    MSB of mantissa is not stored, always 1
  H5T_NORM_MSBSET (`1`)
    MSB of mantissa is always 1
  H5T_NORM_NONE (`2`)
    Mantissa is not normalized
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a valid normalization type if successful; otherwise `H5T_NORM_ERROR` (-1).

Name: H5Tset_norm
Signature:
  herr_t `H5Tset_norm`(hid_t `type_id`, H5T_norm_t `norm` )
Purpose:
  Sets the mantissa normalization of a floating-point datatype.
Description:
  `H5Tset_norm` sets the mantissa normalization of a floating-point datatype. Valid normalization types are:
  H5T_NORM_IMPLIED (`0`)
    MSB of mantissa is not stored, always 1
  H5T_NORM_MSBSET (`1`)
    MSB of mantissa is always 1
  H5T_NORM_NONE (`2`)
    Mantissa is not normalized
Parameters:

hid_t `type_id`
  Identifier of datatype to set.
H5T_norm_t `norm`
  Mantissa normalization type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_inpad
Signature:
  H5T_pad_t `H5Tget_inpad`(hid_t `type_id` )
Purpose:
  Retrieves the internal padding type for unused bits in floating-point datatypes.
Description:
  `H5Tget_inpad` retrieves the internal padding type for unused bits in floating-point datatypes. Valid padding types are:
  H5T_PAD_ZERO (`0`)
    Set background to zeros.
  H5T_PAD_ONE (`1`)
    Set background to ones.
  H5T_PAD_BACKGROUND (`2`)
    Leave background alone.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a valid padding type if successful; otherwise `H5T_PAD_ERROR` (-1).

Name: H5Tset_inpad
Signature:
  herr_t `H5Tset_inpad`(hid_t `type_id`, H5T_pad_t `inpad` )
Purpose:
  Fills unused internal floating point bits.
Description:
  If any internal bits of a floating point type are unused (that is, those significant bits which are not part of the sign, exponent, or mantissa), then `H5Tset_inpad` will be filled according to the value of the padding value property `inpad`. Valid padding types are:
  H5T_PAD_ZERO (`0`)
    Set background to zeros.
  H5T_PAD_ONE (`1`)
    Set background to ones.
  H5T_PAD_BACKGROUND (`2`)
    Leave background alone.
Parameters:

hid_t `type_id`
  Identifier of datatype to modify.
H5T_pad_t `pad`
  Padding type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_cset
Signature:
  H5T_cset_t `H5Tget_cset`(hid_t `type_id` )
Purpose:
  Retrieves the character set type of a string datatype.
Description:
  `H5Tget_cset` retrieves the character set type of a string datatype. Valid character set types are:
  H5T_CSET_ASCII (`0`)
    Character set is US ASCII
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a valid character set type if successful; otherwise `H5T_CSET_ERROR` (-1).

Name: H5Tset_cset
Signature:
  herr_t `H5Tset_cset`(hid_t `type_id`, H5T_cset_t `cset` )
Purpose:
  Sets character set to be used.
Description:
  `H5Tset_cset` the character set to be used.

  HDF5 is able to distinguish between character sets of different nationalities and to convert between them to the extent possible. Valid character set types are:

  H5T_CSET_ASCII (`0`)
    Character set is US ASCII.
Parameters:

hid_t `type_id`
  Identifier of datatype to modify.
H5T_cset_t `cset`
  Character set type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_strpad
Signature:
  H5T_str_t `H5Tget_strpad`(hid_t `type_id` )
Purpose:
  Retrieves the string padding method for a string datatype.
Description:
  `H5Tget_strpad` retrieves the string padding method for a string datatype. Valid string padding types are:
  H5T_STR_NULL (`0`)
    Pad with zeros (as C does)
  H5T_STR_SPACE (`1`)
    Pad with spaces (as FORTRAN does)
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns a valid string padding type if successful; otherwise `H5T_STR_ERROR` (-1).

Name: H5Tset_strpad
Signature:
  herr_t `H5Tset_strpad`(hid_t `type_id`, H5T_str_t `strpad` )
Purpose:
  Defines the storage mechanism for character strings.
Description:
  The method used to store character strings differs with the programming language: C usually null terminates strings while Fortran left-justifies and space-pads strings. `H5Tset_strpad` defines the storage mechanism for the string. Valid string padding values are:
  H5T_STR_NULL (`0`)
    Pad with zeros (as C does)
  H5T_STR_SPACE (`1`)
    Pad with spaces (as FORTRAN does)
Parameters:

hid_t `type_id`
  Identifier of datatype to modify.
H5T_str_t `strpad`
  String padding type.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tget_nmembers
Signature:
  intn `H5Tget_nmembers`(hid_t `type_id` )
Purpose:
  Retrieves the number of fields in a compound datatype.
Description:
  `H5Tget_nmembers` retrieves the number of fields a compound datatype has.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.

Returns:
  Returns number of members datatype has if successful; otherwise FAIL (-1).

Name: H5Tget_member_name
Signature:
  char * `H5Tget_member_name`(hid_t `type_id`, int `field_idx` )
Purpose:
  Retrieves the name of a field of a compound datatype.
Description:
  `H5Tget_member_name` retrieves the name of a field of a compound datatype. Fields are stored in no particular order, with indexes 0 through N-1, where N is the value returned by `H5Tget_nmembers()`. The name of the field is allocated with `malloc()` and the caller is responsible for freeing the memory used by the name.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.
int `field_idx`
  Field index (0-based) of the field name to retrieve.

Returns:
  Returns a valid pointer if successful; otherwise NULL.

Name: H5Tget_member_dims
Signature:
  int `H5Tget_member_dims`(hid_t `type_id`, int `field_idx`, size_t *`dims`, int *`perm` )
Purpose:
  Returns the dimensionality of the field.
Description:
  `H5Tget_member_dims` returns the dimensionality of the field. The dimensions and permuation vector are returned through arguments `dims` and `perm`, both arrays of at least four elements. Either (or even both) may be null pointers.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.
int `field_idx`
  Field index (0-based) of the field `dims` to retrieve.
size_t * `dims`
  Pointer to buffer to store the dimensions of the field.
int * `perm`
  Pointer to buffer to store the permutation vector of the field.

Returns:
  Returns the number of dimensions, a number from 0 to 4, if successful. Otherwise returns FAIL (-1).

Name: H5Tget_member_type
Signature:
  hid_t `H5Tget_member_type`(hid_t `type_id`, int `field_idx` )
Purpose:
  Returns the datatype of the specified member.
Description:
  `H5Tget_member_type` returns the datatype of the specified member. The caller should invoke H5Tclose() to release resources associated with the type.
Parameters:

hid_t `type_id`
  Identifier of datatype to query.
int `field_idx`
  Field index (0-based) of the field type to retrieve.

Returns:
  Returns the identifier of a copy of the datatype of the field if successful; otherwise FAIL (-1).

Name: H5Tinsert
Signature:
  herr_t `H5Tinsert`(hid_t `type_id`, const char * `name`, off_t `offset`, hid_t `field_id` )
Purpose:
  Adds a new member to a compound datatype.
Description:
  `H5Tinsert` adds another member to the compound datatype `type_id`. The new member has a `name` which must be unique within the compound datatype. The `offset` argument defines the start of the member in an instance of the compound datatype, and `field_id` is the datatype identifier of the new member.

  Note: All members of a compound datatype must be atomic; a compound datatype cannot have a member which is a compound datatype.

Parameters:

hid_t `type_id`
  Identifier of compound datatype to modify.
const char * `name`
  Name of the field to insert.
off_t `offset`
  Offset in memory structure of the field to insert.
hid_t `field_id`
  Datatype identifier of the field to insert.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tpack
Signature:
  herr_t `H5Tpack`(hid_t `type_id` )
Purpose:
  Recursively removes padding from within a compound datatype.
Description:
  `H5Tpack` recursively removes padding from within a compound datatype to make it more efficient (space-wise) to store that data.
Parameters:

hid_t `type_id`
  Identifier of datatype to modify.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tregister_hard
Signature:
  herr_t `H5Tregister_hard`(const char * `name`, hid_t `src_id`, hid_t `dst_id`, H5T_conv_t `func` )
Purpose:
  Registers a hard conversion function.
Description:
  `H5Tregister_hard` registers a hard conversion function for a datatype conversion path. The path is specified by the source and destination datatypes `src_id` and `dst_id`. A conversion path can only have one hard function, so `func` replaces any previous hard function.

  If `func` is the null pointer then any hard function registered for this path is removed from this path. The soft functions are then used when determining which conversion function is appropriate for this path. The `name` argument is used only for debugging and should be a short identifier for the function.

  The type of the conversion function pointer is declared as:
  `typedef` herr_t (`*H5T_conv_t`) (hid_t `src_id`, hid_t `dst_id`, H5T_cdata_t *`cdata`, size_t `nelmts`, void *`buf`, void *`bkg)`;

Parameters:

const char * `name`
  Name displayed in diagnostic output.
hid_t `src_id`
  Identifier of source datatype.
hid_t `dst_id`
  Identifier of destination datatype.
H5T_conv_t `func`
  Function to convert between source and destination datatypes.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tregister_soft
Signature:
  herr_t `H5Tregister_soft`(const char * `name`, H5T_class_t `src_cls`, H5T_class_t `dst_cls`, H5T_conv_t `func` )
Purpose:
  Registers a soft conversion function.
Description:
  `H5Tregister_soft` registers a soft conversion function by adding it to the end of the master soft list and replacing the soft function in all applicable existing conversion paths. The `name` is used only for debugging and should be a short identifier for the function.

  The type of the conversion function pointer is declared as:
  `typedef` herr_t (`*H5T_conv_t`) (hid_t `src_id`, hid_t `dst_id`, H5T_cdata_t *`cdata`, size_t `nelmts`, void *`buf`, void *`bkg)`;

Parameters:

const char * `name`
  Name displayed in diagnostic output.
H5T_class_t `src_cls`
  Identifier of source datatype class.
H5T_class_t `dst_cls`
  Identifier of destination datatype class.
H5T_conv_t `func`
  Function to convert between source and destination datatypes.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tunregister
Signature:
  herr_t `H5Tunregister`(H5T_conv_t `func` )
Purpose:
  Removes a conversion function from all conversion paths.
Description:
  `H5Tunregister` removes a conversion function from all conversion paths.

  The type of the conversion function pointer is declared as:
  `typedef` herr_t (`*H5T_conv_t`) (hid_t `src_id`, hid_t `dst_id`, H5T_cdata_t *`cdata`, size_t `nelmts`, void *`buf`, void *`bkg)`;

Parameters:

H5T_conv_t `func`
  Function to remove from conversion paths.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

Name: H5Tclose
Signature:
  herr_t `H5Tclose`(hid_t `type_id` )
Purpose:
  Releases a datatype.
Description:
  `H5Tclose` releases a datatype. Further access through the datatype identifier is illegal. Failure to release a datatype with this call will result in resource leaks.
Parameters:

hid_t `type_id`
  Identifier of datatype to release.

Returns:
  Returns SUCCEED (0) if successful; otherwise FAIL (-1).

HDF5 Reference Manual H5 H5A H5D H5E H5F H5G H5P H5S H5T H5Z Tools

HDF Help Desk
Last modified: 2 September 1998