10#if !H5_VERSION_GE(1, 12, 0)
11inline herr_t h5d_vlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id,
void* buf) {
12 herr_t err = H5Dvlen_reclaim(type_id, space_id, dxpl_id, buf);
14 throw DataSetException(
"Failed to reclaim HDF5 internal memory");
21inline hsize_t h5d_get_storage_size(hid_t dset_id) {
26 return H5Dget_storage_size(dset_id);
29inline hid_t h5d_get_space(hid_t dset_id) {
30 hid_t dset = H5Dget_space(dset_id);
31 if (dset == H5I_INVALID_HID) {
33 std::string(
"Unable to get dataspace of the dataset"));
39inline hid_t h5d_get_type(hid_t dset_id) {
40 hid_t type_id = H5Dget_type(dset_id);
41 if (type_id == H5I_INVALID_HID) {
43 std::string(
"Unable to get datatype of the dataset"));
49inline herr_t h5d_read(hid_t dset_id,
55 herr_t err = H5Dread(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf);
63inline herr_t h5d_write(hid_t dset_id,
69 herr_t err = H5Dwrite(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf);
77inline haddr_t h5d_get_offset(hid_t dset_id) {
78 uint64_t addr = H5Dget_offset(dset_id);
79 if (addr == HADDR_UNDEF) {
86inline herr_t h5d_set_extent(hid_t dset_id,
const hsize_t size[]) {
87 herr_t err = H5Dset_extent(dset_id, size);
88 if (H5Dset_extent(dset_id, size) < 0) {
95inline hid_t h5d_create2(hid_t loc_id,
102 hid_t dataset_id = H5Dcreate2(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id);
104 if (dataset_id == H5I_INVALID_HID) {
106 std::string(
"Failed to create the dataset \"") + name +
"\":");
112inline hid_t h5d_open2(hid_t loc_id,
const char* name, hid_t dapl_id) {
113 hid_t dataset_id = H5Dopen2(loc_id, name, dapl_id);
115 if (dataset_id == H5I_INVALID_HID) {
Definition H5_definitions.hpp:22
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43