HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

# H5::StrType Class Reference

`#include <H5StrType.h>`

Inheritance diagram for H5::StrType:

List of all members.

## Public Member Functions
| StrType (const PredType &pred_type)
| Creates a string datatype using a predefined type.
| StrType (const PredType &pred_type, const size_t &size)
| Creates a string datatype with a specified length.
| StrType (const int dummy, const size_t &size)
| Creates a string datatype with a specified length.
| StrType (const DataSet &dataset)
| Gets the string datatype of the specified dataset.
H5T_cset_t | getCset () const
| Retrieves the character set type of this string datatype.
void | setCset (H5T_cset_t cset) const
| Sets character set to be used.
H5T_str_t | getStrpad () const
| Retrieves the storage mechanism for of this string datatype.
void | setStrpad (H5T_str_t strpad) const
| Defines the storage mechanism for this string datatype.
virtual H5std_string | fromClass () const
| StrType ()
| Default constructor: Creates a stub string datatype.
| StrType (const hid_t existing_id)
| Creates an StrType object using the id of an existing datatype.
| StrType (const StrType &original)
| Copy constructor: makes a copy of the original StrType object.
virtual | ~StrType ()
| Properly terminates access to this string datatype.

## Constructor & Destructor Documentation

H5::StrType::StrType | ( | const PredType & | pred_type | ) |

Creates a string datatype using a predefined type.

Parameters:

  | pred_type | - IN: Predefined datatype

Exceptions:

  | H5::DataTypeIException |

H5::StrType::StrType | ( | const PredType & | pred_type,
|  | const size_t & | size |
| ) |  |  |

Creates a string datatype with a specified length.

Note:
  The use of this constructor can be shortened by using its overloaded below as StrType(0, size).

H5::StrType::StrType | ( | const int | dummy,
|  | const size_t & | size |
| ) |  |  |

Creates a string datatype with a specified length.

Parameters:

  | dummy | - IN: To simplify calling the previous constructor and avoid prototype clash with another constructor
  | size | - IN: Length of the new string type

Exceptions:

  | H5::DataTypeIException |

Description
  The 1st argument is just a dummy to simplify calling the previous constructor, such as: StrType atype(0, size) instead of StrType atype(PredType::C_S1, size)

Note:
  This constructor may replace the previous one in the future.

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

Gets the string datatype of the specified dataset.

Parameters:

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

Exceptions:

  | H5::DataTypeIException |

H5::StrType::StrType | ( |  | ) |

Default constructor: Creates a stub string datatype.

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

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

Parameters:

  | existing_id | - IN: Id of an existing datatype

Exceptions:

  | H5::DataTypeIException |

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

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

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

Properly terminates access to this string datatype.

## Member Function Documentation

H5T_cset_t H5::StrType::getCset | ( |  | ) | const

Retrieves the character set type of this string datatype.

Returns:
  Character set type, which can be:
  - `H5T_CSET_ASCII` (0) - Character set is US ASCII.

Exceptions:

  | H5::DataTypeIException |

void H5::StrType::setCset | ( | H5T_cset_t | cset | ) | const

Sets character set to be used.

Parameters:

  | cset | - IN: character set type, which can be: `H5T_CSET_ASCII` (0) - Character set is US ASCII.

Exceptions:

  | H5::DataTypeIException |

H5T_str_t H5::StrType::getStrpad | ( |  | ) | const

Retrieves the storage mechanism for of this string datatype.

Returns:
  String storage mechanism, which can be:
  - `H5T_STR_NULLTERM` (0) - Null terminate (as C does)
  - `H5T_STR_NULLPAD` (0) - Pad with zeros
  - `H5T_STR_SPACEPAD` (0) - pad with spaces (as FORTRAN does)

Exceptions:

  | H5::DataTypeIException |

void H5::StrType::setStrpad | ( | H5T_str_t | strpad | ) | const

Defines the storage mechanism for this string datatype.

Parameters:

  | strpad | - IN: String padding type

Exceptions:

  | H5::DataTypeIException |

Description
  For detail, please refer to the C layer Reference Manual at: ../RM_H5T.html::Datatype-SetStrpad

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

Reimplemented from H5::AtomType.