55 template<
typename Valtype>
56 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Position<Valtype>& p );
57 template<
typename Valtype>
58 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Position<Valtype>& p );
59 template<
typename Valtype>
60 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Position2D<Valtype>& p );
61 template<
typename Valtype>
62 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Position2D<Valtype>& p );
63 template<
typename Valtype>
64 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Vector<Valtype>& v );
65 template<
typename Valtype>
66 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Vector<Valtype>& v );
67 template<
typename Valtype,
typename ValtypeT>
69 template<
typename Valtype,
typename ValtypeT>
71 template<
typename Valtype,
typename ValtypeT>
73 template<
typename Valtype,
typename ValtypeT>
75 template<
typename Valtype,
typename ValtypeT>
76 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Frame<Valtype,ValtypeT>& f );
77 template<
typename Valtype,
typename ValtypeT>
79 template<
typename Valtype>
80 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& pt,
const Box<Valtype>& section );
81 template<
typename Valtype>
82 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& pt,
const Rect<Valtype>& rect );
92 template<
typename Valtype>
inline
93 void ReadPosition(
const boost::property_tree::ptree& pt,
Position<Valtype>& position ){
99 template<
typename Valtype>
inline
100 bool FindPosition(
const boost::property_tree::ptree& pt,
Position<Valtype>& position ){
101 auto iter = pt.find(
"Position" );
102 if( iter == pt.not_found() )
105 ReadPosition( iter->second, position );
109 template<
typename Valtype>
inline
110 void ReadPosition2D(
const boost::property_tree::ptree& pt,
Position2D<Valtype>& position ){
115 template<
typename Valtype>
inline
116 void ReadVector(
const boost::property_tree::ptree& pt,
Vector<Valtype>& vector ){
122 template<
typename Valtype>
inline
123 bool FindVector(
const boost::property_tree::ptree& pt,
Vector<Valtype>& vector ){
124 const auto iter = pt.find(
"Vector" );
125 if( iter == pt.not_found() )
128 ReadVector( iter->second, vector );
132 template<
typename Valtype,
typename ValtypeT>
inline
136 auto iter = pt.begin();
138 if( iter == pt.end() ||
139 iter->first !=
"Position" )
141 ReadPosition( iter->second, frame.
P );
143 if( ++iter == pt.end() ||
144 iter->first !=
"Vector" )
146 ReadVector( iter->second, frame.
T );
148 if( ++iter == pt.end() ||
149 iter->first !=
"Vector" )
151 ReadVector( iter->second, frame.
N );
153 if( ++iter == pt.end() ||
154 iter->first !=
"Vector" )
156 ReadVector( iter->second, frame.
B );
159 template<
typename Valtype,
typename ValtypeT>
inline
161 const auto iter = pt.find(
"Frame" );
162 if( iter == pt.not_found() )
165 ReadFrame( iter->second, frame );
169 template<
typename Valtype,
typename ValtypeT>
inline
173 auto iter = pt.begin();
175 if( iter == pt.end() ||
176 iter->first !=
"Position" )
180 if( ++iter == pt.end() ||
181 iter->first !=
"Vector" )
186 template<
typename Valtype,
typename ValtypeT>
inline
190 auto iter = pt.begin();
192 if( iter == pt.end() ||
193 iter->first !=
"Position" )
197 if( ++iter == pt.end() ||
198 iter->first !=
"Vector" )
202 if( ++iter == pt.end() ||
203 iter->first !=
"Vector" )
208 template<
typename Valtype>
inline
209 void ReadRect(
const boost::property_tree::ptree& pt,
Rect<Valtype>& rect ){
216 template<
typename Valtype>
inline
217 void ReadArea(
const boost::property_tree::ptree& pt,
Box<Valtype>& area ){
226 template<
typename Valtype>
inline
227 bool FindArea(
const boost::property_tree::ptree& pt,
Box<Valtype>& area ){
228 auto iter = pt.find(
"Area" );
229 if( iter == pt.not_found() )
232 ReadArea( iter->second, area );
237 template<
typename Valtype>
238 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Position<Valtype>& p ){
239 boost::property_tree::ptree ptPosition;
240 ptPosition.add(
"<xmlattr>.x", p.
x );
241 ptPosition.add(
"<xmlattr>.y", p.
y );
242 ptPosition.add(
"<xmlattr>.z", p.
z );
243 opt.add_child(
"Position", ptPosition );
247 template<
typename Valtype>
248 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Position<Valtype>& p ){
249 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
250 if( (*iter).first ==
"Position" ){
260 assert( !
"Syntax error: no Position tag!" );
264 template<
typename Valtype>
265 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Position2D<Valtype>& p ){
266 boost::property_tree::ptree ptPosition;
267 ptPosition.add(
"<xmlattr>.x", p.
x );
268 ptPosition.add(
"<xmlattr>.y", p.
y );
269 opt.add_child(
"Position2D", ptPosition );
273 template<
typename Valtype>
274 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Position2D<Valtype>& p ){
275 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
276 if( (*iter).first ==
"Position2D" ){
285 assert( !
"Syntax error: no Position tag!" );
289 template<
typename Valtype>
290 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Vector<Valtype>& v ){
291 boost::property_tree::ptree ptVector;
292 ptVector.add(
"<xmlattr>.dx", v.
dx );
293 ptVector.add(
"<xmlattr>.dy", v.
dy );
294 ptVector.add(
"<xmlattr>.dz", v.
dz );
295 opt.add_child(
"Vector", ptVector );
299 template<
typename Valtype>
300 boost::property_tree::ptree& operator >> ( boost::property_tree::ptree& ipt,
Vector<Valtype>& v ){
301 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
302 if( (*iter).first ==
"Vector" ){
312 assert( !
"Syntax error: no Vector tag!" );
316 template<
typename Valtype,
typename ValtypeT>
318 boost::property_tree::ptree ptVectorBundle;
319 ptVectorBundle << vb.
P << vb.
T;
320 opt.add_child(
"VectorBundle", ptVectorBundle );
324 template<
typename Valtype,
typename ValtypeT>
326 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
327 if( (*iter).first ==
"VectorBundle" )
329 (*iter).second >> vb.
P >> vb.
T;
335 assert( !
"Syntax error: no VectorBundle tag!" );
339 template<
typename Valtype,
typename ValtypeT>
341 boost::property_tree::ptree ptVectorBundle2;
342 ptVectorBundle2 << vb2.
P << vb2.
T << vb2.
N;
343 opt.add_child(
"VectorBundle2", ptVectorBundle2 );
347 template<
typename Valtype,
typename ValtypeT>
349 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
350 if( (*iter).first ==
"VectorBundle2" )
352 (*iter).second >> vb2.
P >> vb2.
T >> vb2.
N;
358 assert( !
"Syntax error: no VectorBundle2 tag!" );
362 template<
typename Valtype,
typename ValtypeT>
363 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& opt,
const Frame<Valtype,ValtypeT>& f ){
364 boost::property_tree::ptree ptFrame;
365 ptFrame << f.
P << f.
T << f.
N << f.
B;
366 opt.add_child(
"Frame", ptFrame );
370 template<
typename Valtype,
typename ValtypeT>
372 for(
auto iter = ipt.begin(); iter != ipt.end(); ++iter ){
373 if( (*iter).first ==
"Frame" )
375 (*iter).second >> f.
P >> f.
T >> f.
N >> f.
B;
381 assert( !
"Syntax error: no Frame tag!" );
385 template<
typename Valtype>
386 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& pt,
const Box<Valtype>& area ){
387 boost::property_tree::ptree ptArea;
389 ptArea.add(
"<xmlattr>.xnear", area.
NearX() );
390 ptArea.add(
"<xmlattr>.xfar", area.
FarX() );
391 ptArea.add(
"<xmlattr>.ynear", area.
NearY() );
392 ptArea.add(
"<xmlattr>.yfar", area.
FarY() );
393 ptArea.add(
"<xmlattr>.znear", area.
NearZ() );
394 ptArea.add(
"<xmlattr>.zfar", area.
FarZ() );
396 pt.add_child(
"Area", ptArea );
400 template<
typename Valtype>
401 boost::property_tree::ptree& operator << ( boost::property_tree::ptree& pt,
const Rect<Valtype>& rect ){
402 boost::property_tree::ptree ptRect;
404 ptRect.add(
"<xmlattr>.left", rect.
Left() );
405 ptRect.add(
"<xmlattr>.top", rect.
Top() );
406 ptRect.add(
"<xmlattr>.right", rect.
Right() );
407 ptRect.add(
"<xmlattr>.bottom", rect.
Bottom() );
409 pt.add_child(
"Rect", ptRect );