25 #include <pni/core/types.hpp>
26 #include <pni/core/error.hpp>
27 #include "../nximp_code.hpp"
28 #include "../nxobject.hpp"
29 #include "../nxobject_traits.hpp"
53 template<nximp_code>
class OTYPE,
56 pni::core::string
get_class(
const OTYPE<IMPID> &group)
59 typedef typename trait_type::field_type field_type;
60 typedef typename trait_type::attribute_type attribute_type;
61 typedef OTYPE<IMPID> arg_type;
63 static_assert(!(std::is_same<arg_type,field_type>::value ||
64 std::is_same<arg_type,attribute_type>::value),
65 "get_class CAN ONLY BE USED WITH GROUP TYPES");
67 pni::core::string group_class;
68 if(group.attributes.exists(
"NX_class"))
69 group.attributes[
"NX_class"].read(group_class);
146 throw type_error(EXCEPTION_RECORD,
147 "Fields do not have a class!");
167 throw type_error(EXCEPTION_RECORD,
168 "Attributes do not have a class!");
185 throw type_error(EXCEPTION_RECORD,
186 "Links do not have a type!");
220 return boost::apply_visitor(visitor_type(),o);
result_type operator()(const field_type &) const
process fields
Definition: get_class.hpp:143
LTYPE link_type
NeXus link type.
Definition: get_class.hpp:106
pni::core::string result_type
result type
Definition: get_class.hpp:98
ATYPE attribute_type
Nexus attribute type.
Definition: get_class.hpp:104
Definition: cbf_reader.hpp:41
result_type operator()(const attribute_type &) const
process attributes
Definition: get_class.hpp:164
nximp_code
implementation codes
Definition: nximp_code.hpp:40
result_type operator()(const link_type &) const
process links
Definition: get_class.hpp:182
pni::core::string get_class(const OTYPE< IMPID > &group)
get the class of a group
Definition: get_class.hpp:56
result_type operator()(const group_type &g) const
process groups
Definition: get_class.hpp:126
get class visitor
Definition: get_class.hpp:94
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
FTYPE field_type
Nexus field type.
Definition: get_class.hpp:102
GTYPE group_type
Nexus group type.
Definition: get_class.hpp:100