9 #ifndef H5DATASET_MISC_HPP
10 #define H5DATASET_MISC_HPP
19 #include <boost/multi_array.hpp>
22 #include <H5Dpublic.h>
23 #include <H5Ppublic.h>
30 return details::get_name([&](
char *buffer, hsize_t length) {
31 return H5Iget_name(
_hid, buffer, length);
36 return H5Dget_storage_size(
_hid);
45 if ((space.
_hid = H5Dget_space(
_hid)) < 0) {
46 HDF5ErrMapper::ToException<DataSetException>(
47 "Unable to get DataSpace out of DataSet");
57 uint64_t addr = H5Dget_offset(
_hid);
58 if (addr == HADDR_UNDEF) {
59 HDF5ErrMapper::ToException<DataSetException>(
60 "Cannot get offset of DataSet.");
68 if (dims.size() != numDimensions) {
69 HDF5ErrMapper::ToException<DataSetException>(
70 "Invalid dataspace dimensions, got " + std::to_string(dims.size()) +
71 " expected " + std::to_string(numDimensions));
74 std::vector<hsize_t> real_dims(dims.begin(), dims.end());
76 if (H5Dset_extent(
getId(), real_dims.data()) < 0) {
77 HDF5ErrMapper::ToException<DataSetException>(
78 "Could not resize dataset.");
DataSpace getMemSpace() const
getMemSpace
Definition: H5DataSet_misc.hpp:52
void resize(const std::vector< size_t > &dims)
Change the size of the dataset.
Definition: H5DataSet_misc.hpp:65
DataType getDataType() const
getDataType
Definition: H5DataSet_misc.hpp:39
uint64_t getOffset() const
getOffset
Definition: H5DataSet_misc.hpp:56
uint64_t getStorageSize() const
getStorageSize
Definition: H5DataSet_misc.hpp:35
std::string getPath() const
return the path to the current dataset
Definition: H5DataSet_misc.hpp:29
DataSpace getSpace() const
getSpace
Definition: H5DataSet_misc.hpp:43
Class representing the space (dimensions) of a dataset.
Definition: H5DataSpace.hpp:37
std::vector< size_t > getDimensions() const
getDimensions
Definition: H5Dataspace_misc.hpp:99
HDF5 Data Type.
Definition: H5DataType.hpp:42
hid_t getId() const noexcept
getId
Definition: H5Object_misc.hpp:55
hid_t _hid
Definition: H5Object.hpp:81
Definition: H5_definitions.hpp:15