Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual JRootWriterput (const JEquation &equation) override
 Write equation. More...
 
const JRootDictionary_tgetDictionary () const
 Get dictictionary. More...
 
template<class T >
JRootWriterput (const T &object)
 Write object according equation format. More...
 
template<class T >
JRootWriterput (const std::string &key, const T &value)
 Write given key and value according equation format. More...
 
JRootWriterput (const JRootWritableClass &cls)
 Write ROOT class according equation format. More...
 
JRootWriterput (JRootWritableClass &cls)
 Write ROOT class according equation format. More...
 
JRootWriterput (const std::string &prefix, const JRootWritableClass &cls, bool eol)
 Write ROOT class according equation format. More...
 
template<class T >
JRootWriterputObject (const T &object)
 Write object. More...
 
JRootWriterputObject (const JRootWritableClass &cls)
 Write ROOT class. More...
 

Private Attributes

Headheader
 

Detailed Description

Implementation for Head output of JHead objects with ROOT dictionary.

Definition at line 28 of file JHeadWriter.hh.

Constructor & Destructor Documentation

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  :
44  header(header)
45  {}
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
JRootWriter(std::ostream &out, const JEquationParameters &parameters, const JRootDictionary_t &dictionary)
Constructor.
const JRootDictionary_t & dictionary
static JNullStream null
Null I/O stream.
Definition: JNullStream.hh:51

Member Function Documentation

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  }
std::string getTag(const std::string &tag)
Get tag without aanet extension &quot;_&lt;counter&gt;&quot; for identical tags.
Definition: JHead.hh:94
const JRootDictionary_t& JROOT::JRootWriter::getDictionary ( ) const
inlineinherited

Get dictictionary.

Returns
dictionary

Definition at line 324 of file JRootStreamer.hh.

325  {
326  return dictionary;
327  }
const JRootDictionary_t & dictionary
template<class T >
JRootWriter& JROOT::JRootWriter::put ( const T object)
inlineinherited

Write object according equation format.

Parameters
objectobject
Returns
this ROOT writer

Definition at line 337 of file JRootStreamer.hh.

338  {
339  return this->put(JRootWritableClass(object));
340  }
JRootWriter & put(const T &object)
Write object according equation format.
ROOT class for writing object.
Definition: JRootClass.hh:593
template<class T >
JRootWriter& JROOT::JRootWriter::put ( const std::string &  key,
const T value 
)
inlineinherited

Write given key and value according equation format.

Parameters
keykey
valuevalue
Returns
this ROOT writer

Definition at line 351 of file JRootStreamer.hh.

352  {
353  using namespace std;
354  using namespace JPP;
355 
356  ostringstream os;
357 
358  {
359  JRedirectStream redirect(*this, os);
360 
361  this->putObject(value);
362  }
363 
364  return this->put(JEquation(key, os.str()));
365  }
JRootWriter & putObject(const T &object)
Write object.
JRootWriter & put(const T &object)
Write object according equation format.
JRootWriter& JROOT::JRootWriter::put ( const JRootWritableClass cls)
inlineinherited

Write ROOT class according equation format.

Parameters
clsROOT class
Returns
this ROOT writer

Definition at line 374 of file JRootStreamer.hh.

375  {
376  return this->put("", cls, false);
377  }
JRootWriter & put(const T &object)
Write object according equation format.
JRootWriter& JROOT::JRootWriter::put ( JRootWritableClass cls)
inlineinherited

Write ROOT class according equation format.

Parameters
clsROOT class
Returns
this ROOT writer

Definition at line 386 of file JRootStreamer.hh.

387  {
388  return this->put(const_cast<const JRootWritableClass&>(cls));
389  }
JRootWriter & put(const T &object)
Write object according equation format.
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 400 of file JRootStreamer.hh.

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

Write object.

Parameters
objectobject
Returns
this ROOT writer

Definition at line 476 of file JRootStreamer.hh.

477  {
478  return this->putObject(object, JBool<JStreamAvailable<T>::has_ostream>());
479  }
JRootWriter & putObject(const T &object)
Write object.
Test availability of stream operators.
JRootWriter& JROOT::JRootWriter::putObject ( const JRootWritableClass cls)
inlineinherited

Write ROOT class.

Parameters
clsROOT class
Returns
object output

Definition at line 488 of file JRootStreamer.hh.

489  {
490  using namespace std;
491 
492  if (cls.is_valid()) {
493 
494  JRootDictionary_t::const_iterator i = this->getDictionary().find(cls.getTypename());
495 
496  if (i != this->getDictionary().end()) {
497 
498  i->second->putObject(*this, cls.getAddress());
499 
500  } else if (cls.getClass() != NULL) {
501 
502  if (cls.getClass()->GetListOfBases() != NULL) {
503 
504  std::unique_ptr<TIterator> i(cls.getClass()->GetListOfBases()->MakeIterator());
505 
506  for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
507  this->putObject(cls.get(*p));
508  }
509  }
510 
511  if (cls.getClass()->GetListOfDataMembers() != NULL) {
512 
513  std::unique_ptr<TIterator> i(cls.getClass()->GetListOfDataMembers()->MakeIterator());
514 
515  for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
516  if (!JRootClass::is_static(*p)) {
517  this->putObject(cls.get(*p));
518  }
519  }
520  }
521  }
522  }
523 
524  return *this;
525  }
const JRootDictionary_t & getDictionary() const
Get dictictionary.
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:196
JRootWriter & putObject(const T &object)
Write object.
pointer_type getAddress() const
Get address.
Definition: JRootClass.hh:451
JRootAddressableClass get(const TDataMember &data_member) const
Get addressable class of given data member.
Definition: JRootClass.hh:486
bool is_valid() const
Check validity of this addressable class.
Definition: JRootClass.hh:462
TClass * getClass() const
Get class.
Definition: JRootClass.hh:185
static bool is_static(const TDataMember &data_member)
Check if data member is static.
Definition: JRootClass.hh:128

Member Data Documentation

Head& JAANET::JHeadWriter::header
private

Definition at line 70 of file JHeadWriter.hh.


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