24 #include <pni/core/types.hpp>
25 #include <pni/core/arrays/slice.hpp>
26 #include "../nxobject.hpp"
27 #include "../nxobject_traits.hpp"
57 template<nximp_code>
class OTYPE,
61 void write(
const OTYPE<IMPID> &o,
const ATYPE &a)
64 typedef typename trait_type::field_type field_type;
65 typedef typename trait_type::attribute_type attribute_type;
67 static_assert(std::is_same<OTYPE<IMPID>,field_type>::value ||
68 std::is_same<OTYPE<IMPID>,attribute_type>::value,
69 "WRITE CAN ONLY BE USED WITH FIELDS AND "
101 template<nximp_code>
class OTYPE,
106 void write(
const OTYPE<IMPID> &o,
const ATYPE &a,ITYPES ...indices)
109 typedef typename trait_type::field_type field_type;
110 typedef typename trait_type::attribute_type attribute_type;
112 static_assert(std::is_same<OTYPE<IMPID>,field_type>::value ||
113 std::is_same<OTYPE<IMPID>,attribute_type>::value,
114 "WRITE CAN ONLY BE USED WITH FIELDS AND "
117 o(indices...).write(a);
187 throw type_error(EXCEPTION_RECORD,
188 "One cannot write data to a group object!");
213 if(_selection.size())
214 f(_selection).write(_data);
242 if(_selection.size())
243 a(_selection).write(_data);
258 throw type_error(EXCEPTION_RECORD,
259 "Cannot write data to a link object!");
303 std::vector<pni::core::slice> sel{pni::core::slice(indices)...};
304 return boost::apply_visitor(visitor_type(a,sel),o);
320 std::vector<pni::core::slice> sel{pni::core::slice(indices)...};
322 return boost::apply_visitor(visitor_type(a,sel),o);
334 const std::vector<pni::core::slice> &sel)
338 return boost::apply_visitor(visitor_type(a,sel),o);
result_type operator()(const group_type &) const
process group instances
Definition: write.hpp:184
FTYPE field_type
Nexus field type.
Definition: write.hpp:156
LTYPE link_type
Nexus link type.
Definition: write.hpp:160
result_type operator()(const field_type &f) const
process field instances
Definition: write.hpp:211
GTYPE group_type
Nexus group type.
Definition: write.hpp:154
AATYPE attribute_type
Nexus attribute type.
Definition: write.hpp:158
write_visitor(const ATYPE &data, const selection_t &s=selection_t())
constructor
Definition: write.hpp:169
Definition: cbf_reader.hpp:41
selection_t _selection
selection vector
Definition: write.hpp:149
void result_type
result type
Definition: write.hpp:152
result_type operator()(const attribute_type &a) const
process attribute instances
Definition: write.hpp:240
nximp_code
implementation codes
Definition: nximp_code.hpp:40
std::vector< pni::core::slice > selection_t
selection type for partial IO
Definition: write.hpp:144
write visitor
Definition: write.hpp:140
result_type operator()(const link_type &) const
process link instances
Definition: write.hpp:255
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
const ATYPE & _data
reference to the data holding object
Definition: write.hpp:147
void write(const OTYPE< IMPID > &o, const ATYPE &a)
write data to an attribute or field
Definition: write.hpp:61