31 auto seed_details = fetch_seed(group,
"seed", version, options);
34 auto method = load_scalar_string_dataset(group,
"method");
35 if (!is_valid_comparison_operation(method)) {
36 throw std::runtime_error(
"unrecognized operation in 'method' (got '" + method +
"')");
39 auto side = load_scalar_string_dataset(group,
"side");
40 if (side !=
"left" && side !=
"right") {
41 throw std::runtime_error(
"'side' should be either 'left' or 'right' (got '" + side +
"')");
45 auto vhandle = group.openDataSet(
"value");
48 if (version.lt(1, 1, 0)) {
49 val_type = translate_type_0_99(vhandle.getTypeClass());
51 auto type = load_scalar_string_attribute(vhandle,
"type");
52 val_type = translate_type_1_1(type);
53 check_type_1_1(vhandle, val_type);
55 if ((val_type == STRING) != (seed_details.type == STRING)) {
56 throw std::runtime_error(
"both or neither of 'seed' and 'value' should contain strings");
59 validate_missing_placeholder(vhandle, version);
61 size_t ndims = vhandle.getSpace().getSimpleExtentNdims();
63 if (vhandle.getTypeClass() == H5T_STRING) {
64 ritsuko::hdf5::validate_scalar_string(vhandle);
67 }
else if (ndims == 1) {
69 vhandle.getSpace().getSimpleExtentDims(&extent);
70 check_unary_along(group, version, seed_details.dimensions, extent);
71 if (vhandle.getTypeClass() == H5T_STRING) {
72 ritsuko::hdf5::validate_1d_strings(vhandle, extent);
76 throw std::runtime_error(
"dataset should be scalar or 1-dimensional");
79 }
catch (std::exception& e) {
80 throw std::runtime_error(
"failed to validate 'value'; " + std::string(e.what()));
84 seed_details.type = BOOLEAN;
ArrayDetails validate_unary_comparison(const H5::Group &group, const ritsuko::Version &version, const Options &options)
Definition unary_comparison.hpp:30