1#ifndef RITSUKO_HDF5_MISSING_PLACEHOLDER_HPP
2#define RITSUKO_HDF5_MISSING_PLACEHOLDER_HPP
33 throw std::runtime_error(
"expected the '" +
get_name(attr) +
"' attribute to be a scalar");
35 if (type_class_only) {
36 if (attr.getTypeClass() != dset.getTypeClass()) {
37 throw std::runtime_error(
"expected the '" +
get_name(attr) +
"' attribute to have the same type class as its dataset");
40 if (attr.getDataType() != dset.getDataType()) {
41 throw std::runtime_error(
"expected the '" +
get_name(attr) +
"' attribute to have the same type as its dataset");
56template<
typename Type_>
58 if (!handle.attrExists(attr_name)) {
61 auto ahandle = handle.openAttribute(attr_name);
73inline void check_string_missing_placeholder_attribute_preliminary(
const H5::Attribute& attr) {
74 if (!is_scalar(attr)) {
75 throw std::runtime_error(
"expected the '" + get_name(attr) +
"' attribute to be a scalar");
77 if (attr.getTypeClass() != H5T_STRING) {
78 throw std::runtime_error(
"expected the '" + get_name(attr) +
"' attribute to have a string datatype");
95 internal::check_string_missing_placeholder_attribute_preliminary(attr);
109 if (!handle.attrExists(attr_name)) {
112 auto ahandle = handle.openAttribute(attr_name);
113 internal::check_string_missing_placeholder_attribute_preliminary(ahandle);
Get the length of a 1-dimensional HDF5 dataset.
Get the name of a HDF5 object.
std::string get_name(const Handle_ &handle)
Definition get_name.hpp:24
const H5::PredType & as_numeric_datatype()
Definition as_numeric_datatype.hpp:26
bool is_scalar(const H5::DataSpace &space)
Definition get_1d_length.hpp:70
std::optional< Type_ > open_and_load_optional_numeric_missing_placeholder(const H5::DataSet &handle, const char *attr_name)
Definition missing_placeholder.hpp:57
void check_numeric_missing_placeholder_attribute(const H5::DataSet &dset, const H5::Attribute &attr, bool type_class_only=false)
Definition missing_placeholder.hpp:31
void validate_scalar_string_attribute(const H5::Attribute &attr)
Definition validate_string.hpp:149
std::optional< std::string > open_and_load_optional_string_missing_placeholder(const H5::DataSet &handle, const char *attr_name)
Definition missing_placeholder.hpp:108
std::string load_scalar_string_attribute(const H5::Attribute &attr)
Definition load_attribute.hpp:27
void check_string_missing_placeholder_attribute(const H5::Attribute &attr)
Definition missing_placeholder.hpp:94
Assorted helper functions for parsing and validation.
Definition choose_missing_placeholder.hpp:15
Helper functions to validate strings.