Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JHeadWriter Struct Reference

Implementation for Head output of JHead objects with ROOT dictionary. More...

#include <JHeadWriter.hh>

Inheritance diagram for JAANET::JHeadWriter:
JROOT::JRootWriter JLANG::JStreamState

Public Member Functions

 JHeadWriter (Head &header, const JEquationParameters &parameters, const JRootDictionary_t &dictionary)
 Constructor.
 
virtual JRootWriterput (const JEquation &equation) override
 Write equation.
 
template<class T >
JRootWriterput (const T &object)
 Write object according equation format.
 
template<class T >
JRootWriterput (const std::string &key, const T &value)
 Write given key and value according equation format.
 
JRootWriterput (const JRootWritableClass &cls)
 Write ROOT class according equation format.
 
JRootWriterput (JRootWritableClass &cls)
 Write ROOT class according equation format.
 
JRootWriterput (const std::string &prefix, const JRootWritableClass &cls, bool eol)
 Write ROOT class according equation format.
 
const JRootDictionary_tgetDictionary () const
 Get dictictionary.
 
JRootWriterput (const std::string &prefix, const JRootWritableClass &cls, bool eol)
 Write ROOT class according equation format.
 
template<class T >
JRootWriterputObject (const T &object)
 Write object.
 
JRootWriterputObject (const JRootWritableClass &cls)
 Write ROOT class.
 

Private Member Functions

template<class T >
JRootWriterputObject (const T &object, const JBool< true > &option)
 Write object.
 
template<class T >
JRootWriterputObject (const T &object, const JBool< false > &option)
 Write object.
 
template<class JElement_t , class JAllocator_t >
JRootWriterputObject (const std::vector< JElement_t, JAllocator_t > &object, const JBool< false > option)
 Write object.
 

Private Attributes

Headheader
 
const JRootDictionary_tdictionary
 
std::ios & __from
 
std::ios & __to
 

Detailed Description

Implementation for Head output of JHead objects with ROOT dictionary.

Definition at line 28 of file JHeadWriter.hh.

Constructor & Destructor Documentation

◆ JHeadWriter()

JAANET::JHeadWriter::JHeadWriter ( Head & header,
const JEquationParameters & parameters,
const JRootDictionary_t & dictionary )
inline

Constructor.

Parameters
headerheader output
parametersequation parameters
dictionarydictionary

Definition at line 40 of file JHeadWriter.hh.

42 :
45 {}
JRootWriter(std::ostream &out, const JEquationParameters &parameters, const JRootDictionary_t &dictionary)
Constructor.
const JRootDictionary_t & dictionary
static JNullStream null
Null I/O stream.

Member Function Documentation

◆ put() [1/7]

virtual JRootWriter & JAANET::JHeadWriter::put ( const JEquation & equation)
inlineoverridevirtual

Write equation.

Parameters
equationequation
Returns
this ROOT writer

Reimplemented from JROOT::JRootWriter.

Definition at line 54 of file JHeadWriter.hh.

55 {
56 using namespace std;
57
58 string key = equation.getKey();
59
60 for (int i = 1; header.find(key) != header.end(); ++i) {
61 key = getTag(equation.getKey(), i);
62 }
63
64 header[key] = equation.getValue();
65
66 return *this;
67 }
JNET::JTag getTag(JLANG::JType< KM3NETDAQ::JDAQTimeslice >)
Definition JDAQTags.hh:94

◆ put() [2/7]

template<class T >
JRootWriter & JROOT::JRootWriter::put ( const T & object)
inline

Write object according equation format.

Parameters
objectobject
Returns
this ROOT writer

Definition at line 338 of file JRootStreamer.hh.

339 {
340 return this->put(JRootWritableClass(object));
341 }
virtual JRootWriter & put(const JEquation &equation) override
Write equation.

◆ put() [3/7]

template<class T >
JRootWriter & JROOT::JRootWriter::put ( const std::string & key,
const T & value )
inline

Write given key and value according equation format.

Parameters
keykey
valuevalue
Returns
this ROOT writer

Definition at line 352 of file JRootStreamer.hh.

353 {
354 using namespace std;
355 using namespace JPP;
356
357 ostringstream os;
358
359 {
360 JRedirectStream redirect(*this, os);
361
362 this->putObject(value);
363 }
364
365 return this->put(JEquation(key, os.str()));
366 }
General purpose equation class.
Definition JEquation.hh:47
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
JRootWriter & putObject(const T &object)
Write object.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ put() [4/7]

JRootWriter & JROOT::JRootWriter::put ( const JRootWritableClass & cls)
inline

Write ROOT class according equation format.

Parameters
clsROOT class
Returns
this ROOT writer

Definition at line 375 of file JRootStreamer.hh.

376 {
377 return this->put("", cls, false);
378 }

◆ put() [5/7]

JRootWriter & JROOT::JRootWriter::put ( JRootWritableClass & cls)
inline

Write ROOT class according equation format.

Parameters
clsROOT class
Returns
this ROOT writer

Definition at line 387 of file JRootStreamer.hh.

388 {
389 return this->put(const_cast<const JRootWritableClass&>(cls));
390 }

◆ put() [6/7]

JRootWriter & JROOT::JRootWriter::put ( const std::string & prefix,
const JRootWritableClass & cls,
bool eol )
inline

Write ROOT class according equation format.

Parameters
prefixprefix
clsROOT class
eolend-of-line
Returns
object output

Definition at line 401 of file JRootStreamer.hh.

402 {
403 using namespace std;
404 using namespace JPP;
405
406 if (cls.is_valid()) {
407
408 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
409
410 JRootDictionary_t::const_iterator i = this->getDictionary().find(cls.getTypename());
411
412 if (i != this->getDictionary().end()) {
413
414 i->second->put(*this, prefix, cls.getAddress());
415
416 } else if (eol) {
417
418 ostringstream os;
419
420 {
421 JRedirectStream redirect(*this, os);
422
423 this->putObject(cls);
424 }
425
426 this->put(JEquation(prefix, os.str()));
427
428 } else if (cls.getClass() != NULL) {
429
430 if (cls.getClass()->GetListOfBases() != NULL) {
431
432 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfBases()->MakeIterator());
433
434 for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
435 this->put(prefix, cls.get(*p), false);
436 }
437 }
438
439 if (cls.getClass()->GetListOfDataMembers() != NULL) {
440
441 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfDataMembers()->MakeIterator());
442
443 for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
444 if (!JRoot::is_static(*p)) {
445 this->put(facet.getPrefix(prefix,p->GetName()), cls.get(*p), false);
446 }
447 }
448 }
449 }
450 }
451
452 return *this;
453 }
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
const std::string getPrefix(const std::string &prefix, const std::string &name) const
Get combined prefix for output.
const JRootDictionary_t & getDictionary() const
Get dictictionary.

◆ getDictionary()

const JRootDictionary_t & JROOT::JRootWriter::getDictionary ( ) const
inlineinherited

Get dictictionary.

Returns
dictionary

Definition at line 325 of file JRootStreamer.hh.

326 {
327 return dictionary;
328 }

◆ put() [7/7]

JRootWriter & JROOT::JRootWriter::put ( const std::string & prefix,
const JRootWritableClass & cls,
bool eol )
inlineinherited

Write ROOT class according equation format.

Parameters
prefixprefix
clsROOT class
eolend-of-line
Returns
object output

Definition at line 401 of file JRootStreamer.hh.

402 {
403 using namespace std;
404 using namespace JPP;
405
406 if (cls.is_valid()) {
407
408 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
409
410 JRootDictionary_t::const_iterator i = this->getDictionary().find(cls.getTypename());
411
412 if (i != this->getDictionary().end()) {
413
414 i->second->put(*this, prefix, cls.getAddress());
415
416 } else if (eol) {
417
418 ostringstream os;
419
420 {
421 JRedirectStream redirect(*this, os);
422
423 this->putObject(cls);
424 }
425
426 this->put(JEquation(prefix, os.str()));
427
428 } else if (cls.getClass() != NULL) {
429
430 if (cls.getClass()->GetListOfBases() != NULL) {
431
432 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfBases()->MakeIterator());
433
434 for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
435 this->put(prefix, cls.get(*p), false);
436 }
437 }
438
439 if (cls.getClass()->GetListOfDataMembers() != NULL) {
440
441 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfDataMembers()->MakeIterator());
442
443 for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
444 if (!JRoot::is_static(*p)) {
445 this->put(facet.getPrefix(prefix,p->GetName()), cls.get(*p), false);
446 }
447 }
448 }
449 }
450 }
451
452 return *this;
453 }
JRootWriter & put(const T &object)
Write object according equation format.
static bool is_static(const TDataMember &object)
Check if data member is static.
Definition JRoot.hh:109

◆ putObject() [1/5]

template<class T >
JRootWriter & JROOT::JRootWriter::putObject ( const T & object)
inlineinherited

Write object.

Parameters
objectobject
Returns
this ROOT writer

Definition at line 477 of file JRootStreamer.hh.

478 {
479 return this->putObject(object, JBool<JStreamAvailable<T>::has_ostream>());
480 }
Test availability of stream operators.

◆ putObject() [2/5]

JRootWriter & JROOT::JRootWriter::putObject ( const JRootWritableClass & cls)
inlineinherited

Write ROOT class.

Parameters
clsROOT class
Returns
object output

Definition at line 489 of file JRootStreamer.hh.

490 {
491 using namespace std;
492
493 if (cls.is_valid()) {
494
495 JRootDictionary_t::const_iterator i = this->getDictionary().find(cls.getTypename());
496
497 if (i != this->getDictionary().end()) {
498
499 i->second->putObject(*this, cls.getAddress());
500
501 } else if (cls.getClass() != NULL) {
502
503 if (cls.getClass()->GetListOfBases() != NULL) {
504
505 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfBases()->MakeIterator());
506
507 for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
508 this->putObject(cls.get(*p));
509 }
510 }
511
512 if (cls.getClass()->GetListOfDataMembers() != NULL) {
513
514 std::unique_ptr<TIterator> i(cls.getClass()->GetListOfDataMembers()->MakeIterator());
515
516 for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
517 if (!JRoot::is_static(*p)) {
518 this->putObject(cls.get(*p));
519 }
520 }
521 }
522 }
523 }
524
525 return *this;
526 }

◆ putObject() [3/5]

template<class T >
JRootWriter & JROOT::JRootWriter::putObject ( const T & object,
const JBool< true > & option )
inlineprivateinherited

Write object.

Parameters
objectobject
optiontrue
Returns
this ROOT writer

Definition at line 537 of file JRootStreamer.hh.

538 {
539 using namespace JPP;
540
541 *this << white_space;
542 *this << object;
543
544 return *this;
545 }
std::ostream & white_space(std::ostream &out)
Print white space.

◆ putObject() [4/5]

template<class T >
JRootWriter & JROOT::JRootWriter::putObject ( const T & object,
const JBool< false > & option )
inlineprivateinherited

Write object.

Parameters
objectobject
optionfalse
Returns
this ROOT writer

Definition at line 556 of file JRootStreamer.hh.

557 {
558 return this->putObject(JRootWritableClass(object));
559 }

◆ putObject() [5/5]

template<class JElement_t , class JAllocator_t >
JRootWriter & JROOT::JRootWriter::putObject ( const std::vector< JElement_t, JAllocator_t > & object,
const JBool< false > option )
inlineprivateinherited

Write object.

Parameters
objectobject
optionfalse
Returns
this ROOT writer

Definition at line 570 of file JRootStreamer.hh.

571 {
572 this->putObject(object.size());
573
574 for (typename std::vector<JElement_t, JAllocator_t>::const_iterator i = object.begin(); i != object.end(); ++i) {
575 this->putObject(*i);
576 }
577
578 return *this;
579 }

Member Data Documentation

◆ header

Head& JAANET::JHeadWriter::header
private

Definition at line 70 of file JHeadWriter.hh.

◆ dictionary

const JRootDictionary_t& JROOT::JRootWriter::dictionary
privateinherited

Definition at line 582 of file JRootStreamer.hh.

◆ __from

std::ios& JLANG::JStreamState::__from
privateinherited

Definition at line 67 of file JStreamState.hh.

◆ __to

std::ios& JLANG::JStreamState::__to
privateinherited

Definition at line 68 of file JStreamState.hh.


The documentation for this struct was generated from the following file: