9inline hid_t h5t_copy(hid_t original) {
10 auto copy = H5Tcopy(original);
11 if (copy == H5I_INVALID_HID) {
12 HDF5ErrMapper::ToException<DataTypeException>(
"Error copying datatype.");
18inline hsize_t h5t_get_size(hid_t hid) {
19 hsize_t size = H5Tget_size(hid);
21 HDF5ErrMapper::ToException<DataTypeException>(
"Error getting size of datatype.");
27inline H5T_sign_t h5t_get_sign(hid_t type_id) {
28 auto sign = H5Tget_sign(type_id);
29 if (sign == H5T_SGN_ERROR) {
30 HDF5ErrMapper::ToException<DataTypeException>(
"Error getting the sign of datatype.");
35inline H5T_cset_t h5t_get_cset(hid_t hid) {
36 auto cset = H5Tget_cset(hid);
37 if (cset == H5T_CSET_ERROR) {
38 HDF5ErrMapper::ToException<DataTypeException>(
"Error getting cset of datatype.");
44inline H5T_str_t h5t_get_strpad(hid_t hid) {
45 auto strpad = H5Tget_strpad(hid);
46 if (strpad == H5T_STR_ERROR) {
47 HDF5ErrMapper::ToException<DataTypeException>(
"Error getting strpad of datatype.");
53inline void h5t_set_size(hid_t hid, hsize_t size) {
54 if (H5Tset_size(hid, size) < 0) {
55 HDF5ErrMapper::ToException<DataTypeException>(
"Error setting size of datatype.");
59inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) {
60 if (H5Tset_cset(hid, cset) < 0) {
61 HDF5ErrMapper::ToException<DataTypeException>(
"Error setting cset of datatype.");
65inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) {
66 if (H5Tset_strpad(hid, strpad) < 0) {
67 HDF5ErrMapper::ToException<DataTypeException>(
"Error setting strpad of datatype.");
71inline int h5t_get_nmembers(hid_t hid) {
72 auto result = H5Tget_nmembers(hid);
75 throw DataTypeException(
"Could not get members of compound datatype");
81inline char* h5t_get_member_name(hid_t type_id,
unsigned membno) {
82 char* name = H5Tget_member_name(type_id, membno);
83 if (name ==
nullptr) {
84 throw DataTypeException(
"Failed to get member names of compound datatype");
91inline size_t h5t_get_member_offset(hid_t type_id,
unsigned membno) {
94 return H5Tget_member_offset(type_id, membno);
97inline hid_t h5t_get_member_type(hid_t type_id,
unsigned membno) {
98 hid_t member_id = H5Tget_member_type(type_id, membno);
101 throw DataTypeException(
"Failed to get member type of compound datatype");
107#if H5_VERSION_GE(1, 12, 0)
108inline herr_t h5t_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id,
void* buf) {
109 herr_t err = H5Treclaim(type_id, space_id, plist_id, buf);
111 throw DataTypeException(
"Failed to reclaim HDF5 internal memory");
118inline H5T_class_t h5t_get_class(hid_t type_id) {
119 H5T_class_t class_id = H5Tget_class(type_id);
120 if (class_id == H5T_NO_CLASS) {
121 throw DataTypeException(
"Failed to get class of type");
127inline htri_t h5t_equal(hid_t type1_id, hid_t type2_id) {
128 htri_t equal = H5Tequal(type1_id, type2_id);
130 throw DataTypeException(
"Failed to compare two datatypes");
136inline htri_t h5t_is_variable_str(hid_t type_id) {
137 htri_t is_variable = H5Tis_variable_str(type_id);
138 if (is_variable < 0) {
139 HDF5ErrMapper::ToException<DataTypeException>(
140 "Failed to check if string is variable length");
145inline herr_t h5t_set_fields(hid_t type_id,
151 herr_t err = H5Tset_fields(type_id, spos, epos, esize, mpos, msize);
153 HDF5ErrMapper::ToException<DataTypeException>(
154 "Failed to create custom floating point data type");
159inline herr_t h5t_set_ebias(hid_t type_id,
size_t ebias) {
160 herr_t err = H5Tset_ebias(type_id, ebias);
162 HDF5ErrMapper::ToException<DataTypeException>(
163 "Failed to exponent bias of floating point data type");
169inline hid_t h5t_create(H5T_class_t type,
size_t size) {
170 hid_t type_id = H5Tcreate(type, size);
171 if (type_id == H5I_INVALID_HID) {
172 HDF5ErrMapper::ToException<DataTypeException>(
"Failed to datatype");
178inline herr_t h5t_insert(hid_t parent_id,
const char* name,
size_t offset, hid_t member_id) {
179 herr_t err = H5Tinsert(parent_id, name, offset, member_id);
181 HDF5ErrMapper::ToException<DataTypeException>(
"Failed to not add new member to datatype");
187inline herr_t h5t_commit2(hid_t loc_id,
193 herr_t err = H5Tcommit2(loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id);
195 HDF5ErrMapper::ToException<DataTypeException>(
"Failed to commit datatype");
201inline herr_t h5t_close(hid_t type_id) {
202 auto err = H5Tclose(type_id);
204 HDF5ErrMapper::ToException<DataTypeException>(
"Failed to close datatype");
210inline hid_t h5t_enum_create(hid_t base_id) {
211 hid_t type_id = H5Tenum_create(base_id);
212 if (type_id == H5I_INVALID_HID) {
213 HDF5ErrMapper::ToException<DataTypeException>(
"Failed to create new enum datatype");
218inline herr_t h5t_enum_insert(hid_t type,
const char* name,
const void* value) {
219 herr_t err = H5Tenum_insert(type, name, value);
221 HDF5ErrMapper::ToException<DataTypeException>(
222 "Failed to add new member to this enum datatype");
227inline hid_t h5t_open2(hid_t loc_id,
const char* name, hid_t tapl_id) {
228 hid_t datatype_id = H5Topen2(loc_id, name, tapl_id);
229 if (datatype_id == H5I_INVALID_HID) {
230 HDF5ErrMapper::ToException<DataTypeException>(
231 std::string(
"Unable to open the datatype \"") + name +
"\":");
Definition assert_compatible_spaces.hpp:15