12#include <initializer_list>
25inline DataSpace make_data_space(hid_t hid) {
38 :
DataSpace(std::vector<size_t>(items)) {}
40template <
typename... Args>
42 :
DataSpace(std::vector<size_t>{dim1,
static_cast<size_t>(dims)...}) {}
44template <
class IT,
typename>
46 std::vector<hsize_t> real_dims(begin, end);
48 _hid = detail::h5s_create_simple(
int(real_dims.size()), real_dims.data(),
nullptr);
60 if (dims.size() != maxdims.size()) {
64 std::vector<hsize_t> real_dims(dims.begin(), dims.end());
65 std::vector<hsize_t> real_maxdims(maxdims.begin(), maxdims.end());
68 std::replace(real_maxdims.begin(),
73 _hid = detail::h5s_create_simple(
int(dims.size()), real_dims.data(), real_maxdims.data());
77 H5S_class_t h5_dataspace_type;
80 h5_dataspace_type = H5S_SCALAR;
83 h5_dataspace_type = H5S_NULL;
87 "Invalid dataspace type: should be "
88 "dataspace_scalar or dataspace_null");
91 _hid = detail::h5s_create(h5_dataspace_type);
101 return static_cast<size_t>(detail::h5s_get_simple_extent_ndims(
_hid));
107 detail::h5s_get_simple_extent_dims(
_hid, dims.data(),
nullptr);
109 return details::to_vector_size_t(std::move(dims));
113 return static_cast<size_t>(detail::h5s_get_simple_extent_npoints(
_hid));
118 detail::h5s_get_simple_extent_dims(
_hid,
nullptr, maxdims.data());
120 std::replace(maxdims.begin(),
124 return details::to_vector_size_t(maxdims);
129 auto dims = details::inspector<T>::getDimensions(value);
133template <std::
size_t N, std::
size_t W
idth>
141inline bool checkDimensions(
const DataSpace& mem_space,
size_t n_dim_requested) {
142 return checkDimensions(mem_space.
getDimensions(), n_dim_requested);
Exception specific to HighFive DataSpace interface.
Definition H5Exception.hpp:112
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:39
static DataSpace FromCharArrayStrings(const char(&string_array)[N][Width])
Create a DataSpace from a value of type string array.
Definition H5Dataspace_misc.hpp:134
static DataSpace fromId(hid_t hid)
Definition H5DataSpace.hpp:261
static DataSpace From(const T &value)
Automatically deduce the DataSpace from a container/value.
Definition H5Dataspace_misc.hpp:128
size_t getNumberDimensions() const
Returns the number of dimensions of a DataSpace.
Definition H5Dataspace_misc.hpp:100
std::vector< size_t > getMaxDimensions() const
Returns the maximum size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:116
DataspaceType
An enum to create scalar and null DataSpace with DataSpace::DataSpace(DataspaceType dtype).
Definition H5DataSpace.hpp:56
@ dataspace_scalar
Value to create scalar DataSpace.
Definition H5DataSpace.hpp:57
@ dataspace_null
Value to create null DataSpace.
Definition H5DataSpace.hpp:58
static DataSpace Scalar()
Create a scalar DataSpace.
Definition H5Dataspace_misc.hpp:51
size_t getElementCount() const
Return the number of elements in this DataSpace.
Definition H5Dataspace_misc.hpp:112
std::vector< size_t > getDimensions() const
Returns the size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:104
DataSpace clone() const
Create a copy of the DataSpace which will have different id.
Definition H5Dataspace_misc.hpp:94
static DataSpace Null()
Create a null DataSpace.
Definition H5Dataspace_misc.hpp:55
static const size_t UNLIMITED
Magic value to specify that a DataSpace can grow without limit.
Definition H5DataSpace.hpp:49
hid_t _hid
Definition H5Object.hpp:105
Definition H5_definitions.hpp:22