24 #include <pni/core/types.hpp>
25 #include <pni/core/arrays/slice.hpp>
27 #include "../nxobject.hpp"
28 #include "../nxobject_traits.hpp"
59 template<nximp_code>
class OTYPE,
63 void read(
const OTYPE<IMPID> &o,ATYPE &a)
66 typedef typename trait_type::field_type field_type;
67 typedef typename trait_type::attribute_type attribute_type;
69 static_assert(std::is_same<OTYPE<IMPID>,field_type>::value ||
70 std::is_same<OTYPE<IMPID>,attribute_type>::value,
71 "WRITE CAN ONLY BE USED WITH FIELDS AND "
106 template<nximp_code>
class OTYPE,
111 void read(
const OTYPE<IMPID> &o,ATYPE &a,ITYPES ...indices)
114 typedef typename trait_type::field_type field_type;
115 typedef typename trait_type::attribute_type attribute_type;
117 static_assert(std::is_same<OTYPE<IMPID>,field_type>::value ||
118 std::is_same<OTYPE<IMPID>,attribute_type>::value,
119 "WRITE CAN ONLY BE USED WITH FIELDS AND "
122 o(indices...).read(a);
188 throw type_error(EXCEPTION_RECORD,
189 "One cannot read data to a group object!");
214 if(_selection.size())
215 f(_selection).read(_data);
242 if(_selection.size())
243 a(_selection).read(_data);
260 throw type_error(EXCEPTION_RECORD,
261 "Cannot read data from a link!");
298 template<
typename ATYPE,
308 std::vector<pni::core::slice> sel{pni::core::slice(indices)...};
309 visitor_t visitor(a,sel);
310 return boost::apply_visitor(visitor,o);
314 template<
typename ATYPE,
324 std::vector<pni::core::slice> sel{pni::core::slice(indices)...};
325 visitor_t visitor(a,sel);
326 return boost::apply_visitor(visitor,o);
370 const std::vector<pni::core::slice> &sel)
373 visitor_t visitor(a,sel);
374 return boost::apply_visitor(visitor,o);
386 const std::vector<pni::core::slice> &sel)
389 visitor_t visitor(a,sel);
390 return boost::apply_visitor(visitor,o);
selection_t _selection
selection vector
Definition: read.hpp:151
FTYPE field_type
Nexus field type.
Definition: read.hpp:158
read visitor
Definition: read.hpp:142
GTYPE group_type
Nexus group type.
Definition: read.hpp:156
std::vector< pni::core::slice > selection_t
selection type for partial IO
Definition: read.hpp:146
result_type operator()(const attribute_type &a) const
process attribute instances
Definition: read.hpp:240
Definition: cbf_reader.hpp:41
result_type operator()(const link_type &) const
process link instances
Definition: read.hpp:257
ATTYPE attribute_type
Nexus attribute type.
Definition: read.hpp:160
result_type operator()(const field_type &f) const
process field instances
Definition: read.hpp:212
ATYPE & _data
reference to the data holding object
Definition: read.hpp:149
nximp_code
implementation codes
Definition: nximp_code.hpp:40
result_type operator()(const group_type &) const
process group instances
Definition: read.hpp:185
void result_type
result type
Definition: read.hpp:154
LTYPE link_type
NeXus link type.
Definition: read.hpp:162
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
read_visitor(ATYPE &data, const selection_t &s=selection_t())
constructor
Definition: read.hpp:171
void read(const OTYPE< IMPID > &o, ATYPE &a)
read data
Definition: read.hpp:63