42 auto dhandle = group.openDataSet(
"dimensions");
43 auto dspace = dhandle.getSpace();
44 if (dspace.getSimpleExtentNdims() != 1) {
45 throw std::runtime_error(
"'dimensions' dataset should be 1-dimensional");
48 dspace.getSimpleExtentDims(&size);
50 throw std::runtime_error(
"'dimensions' dataset should have non-zero length");
53 if (version.lt(1, 1, 0)) {
54 output.
dimensions = load_non_negative_integer_vector_0_99<std::size_t>(dhandle, size);
56 if (ritsuko::hdf5::exceeds_integer_limit(dhandle, 64,
false)) {
57 throw std::runtime_error(
"datatype should fit inside a 64-bit unsigned integer");
59 output.
dimensions = load_dimensions_from_uint64_contents<std::size_t>(dhandle, size);
62 std::throw_with_nested(std::runtime_error(
"failed to validate 'dimensions'"));
66 auto vhandle = group.openDataSet(
"value");
67 if (vhandle.getSpace().getSimpleExtentNdims() != 0) {
68 throw std::runtime_error(
"'value' dataset should be a scalar");
71 if (version.lt(1, 1, 0)) {
72 output.
type = translate_type_0_99(vhandle.getTypeClass());
75 auto thandle = vhandle.openAttribute(
"type");
76 auto type = read_scalar_string_attribute(thandle);
77 output.
type = translate_type_1_1(type);
78 if (!options.details_only) {
79 check_type_1_1(vhandle, output.
type);
82 std::throw_with_nested(std::runtime_error(
"failed to validate the 'type' attribute"));
86 if (!options.details_only) {
87 validate_missing_placeholder(vhandle, version);
88 if (vhandle.getTypeClass() == H5T_STRING) {
89 ritsuko::hdf5::validate_scalar_string(vhandle);
93 std::throw_with_nested(std::runtime_error(
"failed to validate 'value'"));
ArrayDetails validate_constant_array(const H5::Group &group, const ritsuko::Version &version, const Options &options)
Definition constant_array.hpp:38