1#ifndef CHIHAYA_CUSTOM_ARRAY_HPP
2#define CHIHAYA_CUSTOM_ARRAY_HPP
5#include "ritsuko/ritsuko.hpp"
14#include "utils_type.hpp"
15#include "utils_misc.hpp"
16#include "utils_dimensions.hpp"
29inline ArrayDetails validate_minimal_array(
const H5::Group& group,
const ritsuko::Version& version, [[maybe_unused]]
const Options& options) {
33 auto dhandle = group.openDataSet(
"dimensions");
34 auto dspace = dhandle.getSpace();
35 if (dspace.getSimpleExtentNdims() != 1) {
36 throw std::runtime_error(
"expected a 1-dimensional dataset");
39 dspace.getSimpleExtentDims(&len);
41 if (version.lt(1, 1, 0)) {
42 output.dimensions = load_non_negative_integer_vector_0_99<std::size_t>(dhandle, len);
44 if (ritsuko::hdf5::exceeds_integer_limit(dhandle, 64,
false)) {
45 throw std::runtime_error(
"datatype should fit in a 64-bit unsigned integer");
47 output.dimensions = load_dimensions_from_uint64_contents<std::size_t>(dhandle, len);
50 std::throw_with_nested(std::runtime_error(
"failed to validate 'dimensions'"));
54 auto type = read_scalar_string_dataset(group.openDataSet(
"type"));
55 if (type ==
"BOOLEAN") {
56 output.type = BOOLEAN;
57 }
else if (type ==
"INTEGER") {
58 output.type = INTEGER;
59 }
else if (type ==
"FLOAT") {
61 }
else if (type ==
"STRING") {
64 throw std::runtime_error(
"unknown type '" + type +
"'");
67 std::throw_with_nested(std::runtime_error(
"failed to validate 'type'"));
89 return validate_minimal_array(group, version, options);
Namespace for all chihaya functions.
Definition binary_arithmetic.hpp:21
ArrayDetails validate_custom_array(const H5::Group &group, const ritsuko::Version &version, const Options &options)
Definition custom_array.hpp:88
Details about an array.
Definition utils_public.hpp:38
Options for validate().
Definition utils_public.hpp:79
Various public utilities.