chihaya
Validating delayed array operations in HDF5
Loading...
Searching...
No Matches
binary_logic.hpp
Go to the documentation of this file.
1#ifndef CHIHAYA_BINARY_LOGIC_HPP
2#define CHIHAYA_BINARY_LOGIC_HPP
3
4#include "H5Cpp.h"
5#include "ritsuko/ritsuko.hpp"
6#include "ritsuko/hdf5/hdf5.hpp"
7
8#include <stdexcept>
9#include <vector>
10#include <string>
11
12#include "utils_public.hpp"
13#include "utils_logic.hpp"
14#include "utils_misc.hpp"
15
21namespace chihaya {
22
27namespace binary_logic {
28
37inline ArrayDetails validate(const H5::Group& handle, const ritsuko::Version& version, Options& options) {
38 auto left_details = internal_logic::fetch_seed(handle, "left", version, options);
39 auto right_details = internal_logic::fetch_seed(handle, "right", version, options);
40
41 if (!options.details_only) {
42 if (!internal_misc::are_dimensions_equal(left_details.dimensions, right_details.dimensions)) {
43 throw std::runtime_error("'left' and 'right' should have the same dimensions");
44 }
45 }
46
47 auto method = internal_unary::load_method(handle);
48 if (!options.details_only) {
49 if (!internal_logic::is_valid_operation(method)) {
50 throw std::runtime_error("unrecognized 'method' (" + method + ")");
51 }
52 }
53
54 left_details.type = BOOLEAN;
55 return left_details;
56}
57
58}
59
60}
61
62#endif
ArrayDetails validate(const H5::Group &handle, const ritsuko::Version &version, Options &options)
Definition: binary_logic.hpp:37
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
Various public utilities.