12#include <initializer_list>
32 :
DataSpace(std::vector<size_t>(items)) {}
34template <
typename... Args>
36 :
DataSpace(std::vector<size_t>{dim1,
static_cast<size_t>(dims)...}) {}
38template <
class IT,
typename>
40 std::vector<hsize_t> real_dims(begin, end);
42 _hid = detail::h5s_create_simple(
int(real_dims.size()), real_dims.data(),
nullptr);
54 if (dims.size() != maxdims.size()) {
58 std::vector<hsize_t> real_dims(dims.begin(), dims.end());
59 std::vector<hsize_t> real_maxdims(maxdims.begin(), maxdims.end());
62 std::replace(real_maxdims.begin(),
67 _hid = detail::h5s_create_simple(
int(dims.size()), real_dims.data(), real_maxdims.data());
71 H5S_class_t h5_dataspace_type;
74 h5_dataspace_type = H5S_SCALAR;
77 h5_dataspace_type = H5S_NULL;
81 "Invalid dataspace type: should be "
82 "dataspace_scalar or dataspace_null");
85 _hid = detail::h5s_create(h5_dataspace_type);
95 return static_cast<size_t>(detail::h5s_get_simple_extent_ndims(
_hid));
101 detail::h5s_get_simple_extent_dims(
_hid, dims.data(),
nullptr);
103 return details::to_vector_size_t(std::move(dims));
107 return static_cast<size_t>(detail::h5s_get_simple_extent_npoints(
_hid));
112 detail::h5s_get_simple_extent_dims(
_hid,
nullptr, maxdims.data());
114 std::replace(maxdims.begin(),
118 return details::to_vector_size_t(maxdims);
123 auto dims = details::inspector<T>::getDimensions(value);
127template <std::
size_t N, std::
size_t W
idth>
135inline bool checkDimensions(
const DataSpace& mem_space,
size_t n_dim_requested) {
136 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:31
static DataSpace FromCharArrayStrings(const char(&string_array)[N][Width])
Create a DataSpace from a value of type string array.
Definition H5Dataspace_misc.hpp:128
static DataSpace From(const T &value)
Automatically deduce the DataSpace from a container/value.
Definition H5Dataspace_misc.hpp:122
size_t getNumberDimensions() const
Returns the number of dimensions of a DataSpace.
Definition H5Dataspace_misc.hpp:94
std::vector< size_t > getMaxDimensions() const
Returns the maximum size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:110
DataspaceType
An enum to create scalar and null DataSpace with DataSpace::DataSpace(DataspaceType dtype).
Definition H5DataSpace.hpp:48
@ dataspace_scalar
Value to create scalar DataSpace.
Definition H5DataSpace.hpp:49
@ dataspace_null
Value to create null DataSpace.
Definition H5DataSpace.hpp:50
static DataSpace Scalar()
Create a scalar DataSpace.
Definition H5Dataspace_misc.hpp:45
size_t getElementCount() const
Return the number of elements in this DataSpace.
Definition H5Dataspace_misc.hpp:106
std::vector< size_t > getDimensions() const
Returns the size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:98
DataSpace clone() const
Create a copy of the DataSpace which will have different id.
Definition H5Dataspace_misc.hpp:88
static DataSpace Null()
Create a null DataSpace.
Definition H5Dataspace_misc.hpp:49
static const size_t UNLIMITED
Magic value to specify that a DataSpace can grow without limit.
Definition H5DataSpace.hpp:41
hid_t _hid
Definition H5Object.hpp:105
Definition H5_definitions.hpp:22