9 #ifndef RMF_HDF5_CONST_ATTRIBUTES_H
10 #define RMF_HDF5_CONST_ATTRIBUTES_H
12 #include "RMF/config.h"
44 template <
class TypeTraits>
45 typename TypeTraits::Types get_attribute(std::string name)
const {
46 if (!H5Aexists(Base::get_shared_handle()->get_hid(), name.c_str())) {
47 return typename TypeTraits::Types();
49 RMF_HDF5_HANDLE(a, H5Aopen(Base::get_shared_handle()->get_hid(),
50 name.c_str(), H5P_DEFAULT),
52 RMF_HDF5_HANDLE(s, H5Aget_space(a), &H5Sclose);
55 typename TypeTraits::Types ret =
56 TypeTraits::read_values_attribute(a, dim);
61 template <
class CT,
class CF>
62 CT copy_to(
const CF& cf)
const {
63 return CT(cf.begin(), cf.end());
65 bool get_has_attribute(std::string nm)
const {
66 return H5Aexists_by_name(Base::get_handle(),
".", nm.c_str(), H5P_DEFAULT) >
74 #define RMF_HDF5_CONST_ATTRIBUTE(lcname, UCName, PassValue, ReturnValue, \
75 PassValues, ReturnValues) \
76 ReturnValues get_##lcname##_attribute(std::string nm) const { \
77 return get_attribute<UCName##Traits>(nm); \
81 RMF_HDF5_CONST_ATTRIBUTE(
char,
Char,
char,
char, std::string, std::string);
Various general useful macros for IMP.
Handle read/write of Model data from/to files.
Include all non-deprecated headers in RMF.HDF5.
Handle read/write of Model data from/to files.
#define RMF_FOREACH_SIMPLE_TYPE(macroname)