37 auto dhandle = group.openDataSet(
"dimensions");
38 auto dspace = dhandle.getSpace();
39 if (dspace.getSimpleExtentNdims() != 1) {
40 throw std::runtime_error(
"'dimensions' dataset should be 1-dimensional");
43 dspace.getSimpleExtentDims(&size);
45 throw std::runtime_error(
"'dimensions' dataset should have non-zero length");
48 if (version.lt(1, 1, 0)) {
49 output.
dimensions = load_non_negative_integer_vector_0_99<std::size_t>(dhandle, size);
51 if (ritsuko::hdf5::exceeds_integer_limit(dhandle, 64,
false)) {
52 throw std::runtime_error(
"datatype should fit inside a 64-bit unsigned integer");
54 output.
dimensions = load_dimensions_from_uint64_contents<std::size_t>(dhandle, size);
57 std::throw_with_nested(std::runtime_error(
"failed to validate 'dimensions'"));
61 auto vhandle = group.openDataSet(
"value");
62 if (vhandle.getSpace().getSimpleExtentNdims() != 0) {
63 throw std::runtime_error(
"'value' dataset should be a scalar");
66 if (version.lt(1, 1, 0)) {
67 output.
type = translate_type_0_99(vhandle.getTypeClass());
70 auto thandle = vhandle.openAttribute(
"type");
71 auto type = read_scalar_string_attribute(thandle);
72 output.
type = translate_type_1_1(type);
73 if (!options.details_only) {
74 check_type_1_1(vhandle, output.
type);
77 std::throw_with_nested(std::runtime_error(
"failed to validate the 'type' attribute"));
81 if (!options.details_only) {
82 validate_missing_placeholder(vhandle, version);
83 if (vhandle.getTypeClass() == H5T_STRING) {
84 ritsuko::hdf5::validate_scalar_string(vhandle);
88 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:33