25 #include "../algorithms.hpp"
26 #include "../nxobject.hpp"
83 case type_id_t::UINT8:
84 write_object_data<uint8>(p,n);
break;
86 write_object_data<int8>(p,n);
break;
87 case type_id_t::UINT16:
88 write_object_data<uint16>(p,n);
break;
89 case type_id_t::INT16:
90 write_object_data<int16>(p,n);
break;
91 case type_id_t::UINT32:
92 write_object_data<uint32>(p,n);
break;
93 case type_id_t::INT32:
94 write_object_data<int32>(p,n);
break;
95 case type_id_t::UINT64:
96 write_object_data<uint64>(p,n);
break;
97 case type_id_t::INT64:
98 write_object_data<int64>(p,n);
break;
99 case type_id_t::FLOAT32:
100 write_object_data<float32>(p,n);
break;
101 case type_id_t::FLOAT64:
102 write_object_data<float64>(p,n);
break;
103 case type_id_t::FLOAT128:
104 write_object_data<float128>(p,n);
break;
105 case type_id_t::COMPLEX32:
106 write_object_data<complex32>(p,n);
break;
107 case type_id_t::COMPLEX64:
108 write_object_data<complex64>(p,n);
break;
109 case type_id_t::COMPLEX128:
110 write_object_data<complex128>(p,n);
break;
111 case type_id_t::STRING:
112 write_object_data<string>(p,n);
break;
114 throw type_error(EXCEPTION_RECORD,
115 "Cannot handle Nexus data type!");
149 typedef decltype(
get_parent(parent)) object_type;
151 for(object_type a: parent.attributes)
154 if(name ==
"NX_class")
continue;
155 if(name ==
"units")
continue;
156 if(name ==
"long_name")
continue;
160 if(write_predicate(a))
163 p.add_child(
"attribute",attribute_node);
197 PTYPE write_predicate)
207 if(write_predicate(p))
223 n.add_child(key,child);
244 template<nximp_code>
class OTYPE,
286 template<nximp_code>
class OTYPE,
bool is_field(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
check if field
Definition: is_field.hpp:135
void write_object_data(OTYPE &o, node &n)
write data from Nexus to XML
Definition: nexus_to_xml.hpp:59
void append_attributes(const OTYPE &parent, node &p, PTYPE &write_predicate)
append attributes from a nexus type to XML
Definition: nexus_to_xml.hpp:147
static node object_to_xml(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &f)
create XML object from field
Definition: field.hpp:222
size_t get_size(const OTYPE< IMPID > &o)
get number of elements
Definition: get_size.hpp:61
pni::core::string get_name(const node &n)
get name of a node
Definition: node.cpp:138
Definition: cbf_reader.hpp:41
boost::property_tree::ptree node
alias for ptree
Definition: node.hpp:39
static void data_to_xml(node &io_node, const T &value)
write data to XML
Definition: io_node.hpp:147
static node object_to_xml(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &attr)
write attribute to XML
Definition: attribute.hpp:101
default data predicate
Definition: default.hpp:39
FTYPE as_field(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
as field wrapper
Definition: as_field.hpp:166
nximp_code
implementation codes
Definition: nximp_code.hpp:40
void nexus_to_xml(nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &p, node &n, PTYPE write_predicate)
nexus to XML conversion
Definition: nexus_to_xml.hpp:196
Definition: as_attribute.hpp:29
nxobject_trait< IMPID >::object_type get_parent(const OTYPE< IMPID > &o)
return parent
Definition: get_parent.hpp:53
pni::core::type_id_t get_type(const OTYPE< IMPID > &o)
get type
Definition: get_type.hpp:55
GTYPE as_group(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
as group wrapper
Definition: as_group.hpp:167
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
static node object_to_xml(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &group)
write group to XML
Definition: group.hpp:134
void read(const OTYPE< IMPID > &o, ATYPE &a)
read data
Definition: read.hpp:63
bool is_group(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
test for group
Definition: is_group.hpp:136