9inline hid_t h5t_copy(hid_t original) {
10 auto copy = H5Tcopy(original);
11 if (copy == H5I_INVALID_HID) {
18inline hsize_t h5t_get_size(hid_t hid) {
19 hsize_t size = H5Tget_size(hid);
27inline H5T_cset_t h5t_get_cset(hid_t hid) {
28 auto cset = H5Tget_cset(hid);
29 if (cset == H5T_CSET_ERROR) {
36inline H5T_str_t h5t_get_strpad(hid_t hid) {
37 auto strpad = H5Tget_strpad(hid);
38 if (strpad == H5T_STR_ERROR) {
45inline void h5t_set_size(hid_t hid, hsize_t size) {
46 if (H5Tset_size(hid, size) < 0) {
51inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) {
52 if (H5Tset_cset(hid, cset) < 0) {
57inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) {
58 if (H5Tset_strpad(hid, strpad) < 0) {
63inline int h5t_get_nmembers(hid_t hid) {
64 auto result = H5Tget_nmembers(hid);
67 throw DataTypeException(
"Could not get members of compound datatype");
73inline char* h5t_get_member_name(hid_t type_id,
unsigned membno) {
74 char* name = H5Tget_member_name(type_id, membno);
75 if (name ==
nullptr) {
76 throw DataTypeException(
"Failed to get member names of compound datatype");
83inline size_t h5t_get_member_offset(hid_t type_id,
unsigned membno) {
86 return H5Tget_member_offset(type_id, membno);
89inline hid_t h5t_get_member_type(hid_t type_id,
unsigned membno) {
90 hid_t member_id = H5Tget_member_type(type_id, membno);
93 throw DataTypeException(
"Failed to get member type of compound datatype");
99#if H5_VERSION_GE(1, 12, 0)
100inline herr_t h5t_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id,
void* buf) {
101 herr_t err = H5Treclaim(type_id, space_id, plist_id, buf);
103 throw DataTypeException(
"Failed to reclaim HDF5 internal memory");
110inline H5T_class_t h5t_get_class(hid_t type_id) {
111 H5T_class_t class_id = H5Tget_class(type_id);
112 if (class_id == H5T_NO_CLASS) {
113 throw DataTypeException(
"Failed to get class of type");
119inline htri_t h5t_equal(hid_t type1_id, hid_t type2_id) {
120 htri_t equal = H5Tequal(type1_id, type2_id);
122 throw DataTypeException(
"Failed to compare two datatypes");
128inline htri_t h5t_is_variable_str(hid_t type_id) {
129 htri_t is_variable = H5Tis_variable_str(type_id);
130 if (is_variable < 0) {
132 "Failed to check if string is variable length");
137inline herr_t h5t_set_fields(hid_t type_id,
143 herr_t err = H5Tset_fields(type_id, spos, epos, esize, mpos, msize);
146 "Failed to create custom floating point data type");
151inline herr_t h5t_set_ebias(hid_t type_id,
size_t ebias) {
152 herr_t err = H5Tset_ebias(type_id, ebias);
155 "Failed to exponent bias of floating point data type");
161inline hid_t h5t_create(H5T_class_t type,
size_t size) {
162 hid_t type_id = H5Tcreate(type, size);
163 if (type_id == H5I_INVALID_HID) {
170inline herr_t h5t_insert(hid_t parent_id,
const char* name,
size_t offset, hid_t member_id) {
171 herr_t err = H5Tinsert(parent_id, name, offset, member_id);
179inline herr_t h5t_commit2(hid_t loc_id,
185 herr_t err = H5Tcommit2(loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id);
193inline herr_t h5t_close(hid_t type_id) {
194 auto err = H5Tclose(type_id);
202inline hid_t h5t_enum_create(hid_t base_id) {
203 hid_t type_id = H5Tenum_create(base_id);
204 if (type_id == H5I_INVALID_HID) {
210inline herr_t h5t_enum_insert(hid_t type,
const char* name,
const void* value) {
211 herr_t err = H5Tenum_insert(type, name, value);
214 "Failed to add new member to this enum datatype");
219inline hid_t h5t_open2(hid_t loc_id,
const char* name, hid_t tapl_id) {
220 hid_t datatype_id = H5Topen2(loc_id, name, tapl_id);
221 if (datatype_id == H5I_INVALID_HID) {
223 std::string(
"Unable to open the datatype \"") + name +
"\":");
Definition H5_definitions.hpp:22
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43