6 #ifndef ECHELON_HDF5_ATTRIBUTE_REPOSITORY_HPP 7 #define ECHELON_HDF5_ATTRIBUTE_REPOSITORY_HPP 9 #include <echelon/hdf5/type.hpp> 10 #include <echelon/hdf5/type_factory.hpp> 11 #include <echelon/hdf5/attribute.hpp> 13 #include <echelon/hdf5/broken_contract_exception.hpp> 25 class non_existing_attribute_exception :
public std::exception
28 non_existing_attribute_exception(std::string what_) : what_(std::move(what_))
32 ~non_existing_attribute_exception() noexcept
36 const char* what() const noexcept
override 51 template <
typename Parent>
68 return attribute(
object(parent_), name, datatype);
83 return create(name, get_hdf5_type<T>());
123 bool exists(
const std::string& name)
const 125 return hdf5::precursor::is_attribute_existing(hdf5::precursor::object(parent_.id()), name);
158 "match the datatype of the attribute.");
164 return create(name, datatype);
192 template <
typename T>
195 return require(name, get_hdf5_type<T>());
224 template <
typename T>
227 type datatype = get_hdf5_type<T>();
235 "match the datatype of the attribute.");
echelon's core namespace
Definition: attribute.cpp:10
A handle to an HDF5 attribute.
Definition: hdf5/attribute.hpp:24
attribute create(const std::string &name, const type &datatype)
Creates a new attribute.
Definition: hdf5/attribute_repository.hpp:66
attribute operator[](const std::string &name) const
Accessor function for this attribute repository.
Definition: hdf5/attribute_repository.hpp:112
attribute create(const std::string &name)
Creates a new attribute.
Definition: hdf5/attribute_repository.hpp:81
attribute require(const std::string &name, const T &value)
Returns the requested attribute, if it already exists, otherwise a new attribute is created...
Definition: hdf5/attribute_repository.hpp:225
type datatype() const
The value type of the attribute.
Definition: hdf5/attribute.cpp:29
attribute require(const std::string &name, const type &datatype)
Returns the requested attribute, if it already exists, otherwise a new attribute is created...
Definition: hdf5/attribute_repository.hpp:150
A handle to an HDF5 type.
Definition: hdf5/type.hpp:23
bool exists(const std::string &name) const
Tests, if an attribute exists.
Definition: hdf5/attribute_repository.hpp:123
Attribute manager, which should be embedded into a parent object, which supports attributes.
Definition: hdf5/attribute_repository.hpp:52
attribute require(const std::string &name)
Returns the requested attribute, if it already exists, otherwise the attribute is created...
Definition: hdf5/attribute_repository.hpp:193
attribute create(const std::string &name, const T &value)
Creates a new attribute and initializes it with a given value.
Definition: hdf5/attribute_repository.hpp:97
Exception, which is thrown, if a require_*-type method can't fulfill the contract.
Definition: broken_contract_exception.hpp:20