chihaya
Validating delayed array operations in HDF5
Loading...
Searching...
No Matches
unary_special_check.hpp
Go to the documentation of this file.
1#ifndef CHIHAYA_UNARY_SPECIAL_CHECK_HPP
2#define CHIHAYA_UNARY_SPECIAL_CHECK_HPP
3
4#include "H5Cpp.h"
5#include "ritsuko/ritsuko.hpp"
6
7#include <stdexcept>
8
9#include "utils_unary.hpp"
10
16namespace chihaya {
17
22namespace unary_special_check {
23
32inline ArrayDetails validate(const H5::Group& handle, const ritsuko::Version& version, Options& options) {
33 auto seed_details = internal_misc::load_seed_details(handle, "seed", version, options);
34 if (seed_details.type == STRING) {
35 throw std::runtime_error("'seed' should contain integer, float or boolean values");
36 }
37
38 // Checking the method.
39 auto method = internal_unary::load_method(handle);
40 if (!options.details_only) {
41 if (method != "is_nan" &&
42 method != "is_finite" &&
43 method != "is_infinite")
44 {
45 throw std::runtime_error("unrecognized 'method' (" + method + ")");
46 }
47 }
48
49 seed_details.type = BOOLEAN;
50 return seed_details;
51}
52
53}
54
55}
56
57#endif
ArrayDetails validate(const H5::Group &handle, const ritsuko::Version &version, Options &options)
Definition: unary_special_check.hpp:32
Namespace for all chihaya functions.
Definition: binary_arithmetic.hpp:22
Details about an array.
Definition: utils_public.hpp:36
Validation options.
Definition: utils_public.hpp:66
bool details_only
Definition: utils_public.hpp:71