1#ifndef RITSUKO_HDF5_GET_1D_LENGTH_HPP
2#define RITSUKO_HDF5_GET_1D_LENGTH_HPP
25inline hsize_t
get_1d_length(
const H5::DataSpace& space,
bool allow_scalar) {
26 int ndims = space.getSimpleExtentNdims();
29 throw std::runtime_error(
"expected a 1-dimensional dataset, got a scalar instead");
34 throw std::runtime_error(
"expected a 1-dimensional dataset, got " + std::to_string(ndims) +
" dimensions instead");
38 space.getSimpleExtentDims(&dims);
50inline hsize_t
get_1d_length(
const H5::DataSet& handle,
bool allow_scalar) {
62inline hsize_t
get_1d_length(
const H5::Attribute& handle,
bool allow_scalar) {
71 return space.getSimpleExtentNdims() == 0;
bool is_scalar(const H5::DataSpace &space)
Definition get_1d_length.hpp:70
hsize_t get_1d_length(const H5::DataSpace &space, bool allow_scalar)
Definition get_1d_length.hpp:25
Assorted helper functions for parsing and validation.
Definition choose_missing_placeholder.hpp:15