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) {
32 HDF5ErrMapper::ToException<DataSetException>(
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) {
42 HDF5ErrMapper::ToException<DataSetException>(
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);
57 HDF5ErrMapper::ToException<DataSetException>(std::string(
"Unable to read the dataset"));
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);
71 HDF5ErrMapper::ToException<DataSetException>(std::string(
"Unable to write the dataset"));
77#if H5_VERSION_GE(1, 10, 0)
78inline herr_t h5d_flush(hid_t dset_id) {
79 herr_t err = H5Dflush(dset_id);
81 HDF5ErrMapper::ToException<DataSetException>(
"Unable to flush the dataset.");
88#if H5_VERSION_GE(1, 10, 2)
89inline herr_t h5d_refresh(hid_t dset_id) {
90 herr_t err = H5Drefresh(dset_id);
92 HDF5ErrMapper::ToException<DataSetException>(
"Unable to refresh the dataset.");
99inline haddr_t h5d_get_offset(hid_t dset_id) {
100 uint64_t addr = H5Dget_offset(dset_id);
101 if (addr == HADDR_UNDEF) {
102 HDF5ErrMapper::ToException<DataSetException>(
"Cannot get offset of DataSet.");
108inline herr_t h5d_set_extent(hid_t dset_id,
const hsize_t size[]) {
109 herr_t err = H5Dset_extent(dset_id, size);
111 HDF5ErrMapper::ToException<DataSetException>(
"Could not resize dataset.");
117inline hid_t h5d_create2(hid_t loc_id,
124 hid_t dataset_id = H5Dcreate2(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id);
126 if (dataset_id == H5I_INVALID_HID) {
127 HDF5ErrMapper::ToException<DataSetException>(
128 std::string(
"Failed to create the dataset \"") + name +
"\":");
134inline hid_t h5d_open2(hid_t loc_id,
const char* name, hid_t dapl_id) {
135 hid_t dataset_id = H5Dopen2(loc_id, name, dapl_id);
137 if (dataset_id == H5I_INVALID_HID) {
138 HDF5ErrMapper::ToException<DataSetException>(std::string(
"Unable to open the dataset \"") +
Definition assert_compatible_spaces.hpp:15