chihaya
Validating delayed array operations in HDF5
Loading...
Searching...
No Matches
external_hdf5.hpp
Go to the documentation of this file.
1#ifndef CHIHAYA_EXTERNAL_HDF5_HPP
2#define CHIHAYA_EXTERNAL_HDF5_HPP
3
4#include "H5Cpp.h"
5#include "ritsuko/ritsuko.hpp"
6
7#include <exception>
8#include <stdexcept>
9
10#include "custom_array.hpp"
11#include "utils_misc.hpp"
12
18namespace chihaya {
19
32inline ArrayDetails validate_external_hdf5(const H5::Group& group, const ritsuko::Version& version, const Options& options) {
33 if (version.ge(1, 1, 0)) {
34 throw std::runtime_error("'external_hdf5' array type is deprecated in versions >= 1.1");
35 }
36 auto deets = validate_minimal_array(group, version, options);
37 if (!options.details_only) {
38 try {
39 validate_scalar_string_dataset(group.openDataSet("file"));
40 } catch (...) {
41 std::throw_with_nested(std::runtime_error("failed to validate 'file'"));
42 }
43 try {
44 validate_scalar_string_dataset(group.openDataSet("name"));
45 } catch (...) {
46 std::throw_with_nested(std::runtime_error("failed to validate 'name'"));
47 }
48 }
49 return deets;
50}
51
52}
53
54#endif
Validation for custom third-party arrays.
Namespace for all chihaya functions.
Definition binary_arithmetic.hpp:21
ArrayDetails validate_external_hdf5(const H5::Group &group, const ritsuko::Version &version, const Options &options)
Definition external_hdf5.hpp:32
Details about an array.
Definition utils_public.hpp:38
Options for validate().
Definition utils_public.hpp:79
bool details_only
Definition utils_public.hpp:84