24 #include <pni/core/types.hpp>
25 #include "../nxobject.hpp"
58 nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
86 const STYPE &s,
bool o):
146 throw type_error(EXCEPTION_RECORD,
147 "Cannot create an attribute at an attribute!");
165 throw type_error(EXCEPTION_RECORD,
166 "Cannot create an attribute on a link!");
214 nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
216 const pni::core::string &name,
218 bool overwrite=
false)
221 return boost::apply_visitor(visitor_t(name,shape,overwrite),parent);
264 nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
266 const pni::core::string &name,
267 bool overwrite=
false)
270 return create_attribute<T>(parent,name,shape_t{},overwrite);
318 nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
320 pni::core::type_id_t tid,
325 if(tid == type_id_t::UINT8)
326 return create_attribute<uint8>(o,args...);
327 else if(tid == type_id_t::INT8)
328 return create_attribute<int8>(o,args...);
329 else if(tid == type_id_t::UINT16)
330 return create_attribute<uint16>(o,args...);
331 else if(tid == type_id_t::INT16)
332 return create_attribute<int16>(o,args...);
333 else if(tid == type_id_t::UINT32)
334 return create_attribute<uint32>(o,args...);
335 else if(tid == type_id_t::INT32)
336 return create_attribute<int32>(o,args...);
337 else if(tid == type_id_t::UINT64)
338 return create_attribute<uint64>(o,args...);
339 else if(tid == type_id_t::INT64)
340 return create_attribute<int64>(o,args...);
341 else if(tid == type_id_t::FLOAT32)
342 return create_attribute<float32>(o,args...);
343 else if(tid == type_id_t::FLOAT64)
344 return create_attribute<float64>(o,args...);
345 else if(tid == type_id_t::FLOAT128)
346 return create_attribute<float128>(o,args...);
347 else if(tid == type_id_t::COMPLEX32)
348 return create_attribute<complex32>(o,args...);
349 else if(tid == type_id_t::COMPLEX64)
350 return create_attribute<complex64>(o,args...);
351 else if(tid == type_id_t::COMPLEX128)
352 return create_attribute<complex128>(o,args...);
353 else if(tid == type_id_t::BOOL)
354 return create_attribute<bool_t>(o,args...);
355 else if(tid == type_id_t::STRING)
356 return create_attribute<string>(o,args...);
358 throw type_error(EXCEPTION_RECORD,
359 "Unknown type code!");
ATYPE attribute_type
Nexus attribute type.
Definition: create_attribute.hpp:73
result_type operator()(const attribute_type &) const
process attribute instances
Definition: create_attribute.hpp:143
GTYPE group_type
Nexus group type.
Definition: create_attribute.hpp:69
nxobject< GTYPE, FTYPE, ATYPE, LTYPE > result_type
result type
Definition: create_attribute.hpp:67
FTYPE field_type
Nexus field type.
Definition: create_attribute.hpp:71
Definition: cbf_reader.hpp:41
pni::core::string _name
the name of the field
Definition: create_attribute.hpp:62
LTYPE link_type
link type
Definition: create_attribute.hpp:75
result_type operator()(const field_type &f) const
process field instances
Definition: create_attribute.hpp:124
nxobject< GTYPE, FTYPE, ATYPE, LTYPE > create_attribute(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const pni::core::string &name, const STYPE &shape, bool overwrite=false)
create multidimensional attribute
Definition: create_attribute.hpp:215
create_attribute_visitor(const pni::core::string &n, const STYPE &s, bool o)
constructor
Definition: create_attribute.hpp:85
STYPE _shape
shape of field
Definition: create_attribute.hpp:63
create attribute visitor
Definition: create_attribute.hpp:57
result_type operator()(const link_type &) const
process link instances
Definition: create_attribute.hpp:162
result_type operator()(const group_type &g) const
process group instances
Definition: create_attribute.hpp:105
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
bool _overwrite
overwrite flag for the attribute
Definition: create_attribute.hpp:64