62 auto dhandle = group.openDataSet(
"data");
63 auto dspace = dhandle.getSpace();
64 const auto ndims = dspace.getSimpleExtentNdims();
66 throw std::runtime_error(
"expected at least one dimension");
69 dspace.getSimpleExtentDims(dims.data());
71 if (version.lt(1, 1, 0)) {
72 output.
type = translate_type_0_99(dhandle.getTypeClass());
73 if (is_boolean_0_99(dhandle)) {
74 output.
type = BOOLEAN;
78 auto thandle = dhandle.openAttribute(
"type");
79 auto type = read_scalar_string_attribute(thandle);
80 output.
type = translate_type_1_1(type);
81 if (!options.details_only) {
82 check_type_1_1(dhandle, output.
type);
85 std::throw_with_nested(std::runtime_error(
"failed to validate the 'type' attribute"));
89 if (!options.details_only) {
90 validate_missing_placeholder(dhandle, version);
91 if (dhandle.getTypeClass() == H5T_STRING) {
92 ritsuko::hdf5::validate_nd_strings(
96 ritsuko::hdf5::ValidateNdStringsOptions opt;
97 opt.contiguous_chunk_size = options.contiguous_chunk_size;
104 transplant_dimensions(dims, output.
dimensions);
106 std::throw_with_nested(std::runtime_error(
"failed to validate 'data'"));
111 auto nhandle = group.openDataSet(
"native");
112 if (nhandle.getSpace().getSimpleExtentNdims() != 0) {
113 throw std::runtime_error(
"expected a scalar dataset");
116 if (version.lt(1, 1, 0)) {
117 native = load_boolean_scalar_0_99(nhandle);
119 if (ritsuko::hdf5::exceeds_integer_limit(nhandle, 8,
true)) {
120 throw std::runtime_error(
"expected a datatype that fits into an 8-bit signed integer");
122 std::int8_t tmp_native;
123 nhandle.read(&tmp_native, H5::PredType::NATIVE_INT);
127 std::throw_with_nested(std::runtime_error(
"failed to validate 'native'"));
131 if (!options.details_only) {
132 if (group.exists(
"dimnames")) {
134 auto dnhandle = group.openGroup(
"dimnames");
135 validate_dimnames_internal(dnhandle, output.
dimensions, version, options.contiguous_chunk_size);
137 std::throw_with_nested(std::runtime_error(
"failed to validate 'dimnames'"));
ArrayDetails validate_dense_array(const H5::Group &group, const ritsuko::Version &version, const Options &options)
Definition dense_array.hpp:58