24 #include <pni/core/types.hpp>
25 #include <pni/core/error.hpp>
26 #include "../nxobject_traits.hpp"
51 template<nximp_code>
class OTYPE,
54 void set_class(
const OTYPE<IMPID> &o,
const pni::core::string &nxclass)
61 static_assert(!std::is_same<OTYPE<IMPID>,field_type>::value,
62 "EXEPCTED A GROUP TYPE - GOT A FIELD!");
63 static_assert(!std::is_same<OTYPE<IMPID>,attribute_type>::value,
64 "EXPECTED A GROUP TYPE - GOT AN ATTRIBUTE!");
67 throw type_error(EXCEPTION_RECORD,
68 "Cannot set the nexus class for a non-group "
71 auto attr = o.attributes.template create<string>(
"NX_class",
true);
147 throw type_error(EXCEPTION_RECORD,
"Fields do not have a class!");
162 throw type_error(EXCEPTION_RECORD,
163 "Attributes do not have a class!");
177 throw type_error(EXCEPTION_RECORD,
178 "Links do not have a class!");
209 const pni::core::string &c)
212 boost::apply_visitor(visitor_type(c),o);
set class visitor
Definition: set_class.hpp:94
LTYPE link_type
NeXus link type.
Definition: set_class.hpp:108
result_type operator()(const attribute_type &) const
process attributes
Definition: set_class.hpp:159
nexus object traits
Definition: nxobject_traits.hpp:44
result_type operator()(const link_type &) const
process links
Definition: set_class.hpp:174
Definition: cbf_reader.hpp:41
void set_class(const OTYPE< IMPID > &o, const pni::core::string &nxclass)
set class for a group
Definition: set_class.hpp:54
pni::core::string _class
Nexus class.
Definition: set_class.hpp:97
result_type operator()(const group_type &g) const
process groups
Definition: set_class.hpp:130
ATYPE attribute_type
Nexus attribute type.
Definition: set_class.hpp:106
void result_type
result type
Definition: set_class.hpp:100
nximp_code
implementation codes
Definition: nximp_code.hpp:40
result_type operator()(const field_type &) const
process fields
Definition: set_class.hpp:144
set_class_visitor(const pni::core::string &s)
constructor
Definition: set_class.hpp:116
GTYPE group_type
Nexus group type.
Definition: set_class.hpp:102
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
FTYPE field_type
Nexus field type.
Definition: set_class.hpp:104
bool is_group(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
test for group
Definition: is_group.hpp:136