Jpp  18.0.0-rc.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
JROOT::JRootWritableClass Struct Reference

ROOT class for writing object. More...

#include <JRootClass.hh>

Inheritance diagram for JROOT::JRootWritableClass:
JROOT::JRootAddressableClass< const char * > JROOT::JRootClass JROOT::JAddress< const char * > JLANG::JEquals< JFirst_t, JSecond_t >

Public Types

typedef JAddress< const char * > JAddress_t
 
typedef JAddress_t::pointer_type pointer_type
 

Public Member Functions

template<class T >
 JRootWritableClass (const T &object)
 Constructor. More...
 
 JRootWritableClass (const JRootAddressableClass< const char * > &rc)
 Copy constructor. More...
 
template<class T >
 operator const T & () const
 Type conversion operator. More...
 
pointer_type getAddress () const
 Get address. More...
 
bool is_valid () const
 Check validity of this addressable class. More...
 
JRootAddressableClass find (const char *const name) const
 Find addressable base class or data member with given name within current class. More...
 
JRootClass find (const char *const name, const bool option=true) const
 Find base class or data member with given name within current class. More...
 
JRootAddressableClass get (const TDataMember &data_member) const
 Get addressable class of given data member. More...
 
JRootAddressableClass get (const TBaseClass &base_class) const
 Get addressable class of given base class. More...
 
JRootAddressableClass operator[] (const char *const name) const
 Find addressable base class or data member with given name within current class. More...
 
TDictionary * getDictionary () const
 Get dictionary. More...
 
int getOffset () const
 Get offset of this class with respect to parent class. More...
 
TClass * getClass () const
 Get class. More...
 
const char * getTypename () const
 Get type name. More...
 
bool equals (const JRootClass &object) const
 Test equality of ROOT classes. More...
 
void print (std::ostream &out) const
 Print ROOT class information. More...
 

Static Public Member Functions

static bool is_class (const char *const name)
 Check name of class against ROOT classes. More...
 
static bool is_class (const TBaseClass &base_class)
 Check base class against ROOT class names. More...
 
static bool is_class (const TDataMember &data_member)
 Check data member against ROOT class names. More...
 
static bool is_STLcontainer (const TBaseClass &base_class)
 Check if base class is STL container. More...
 
static bool is_STLcontainer (const TDataMember &data_member)
 Check if data member is STL container. More...
 
static bool is_STLstring (const TDataMember &data_member)
 Check if data member is STL string. More...
 
static bool is_static (const TDataMember &data_member)
 Check if data member is static. More...
 

Public Attributes

pointer_type address
 

Protected Member Functions

void print (std::ostream &out, const std::string &prefix) const
 Print ROOT class information. More...
 

Static Protected Member Functions

static void print (std::ostream &out, const std::string &name, const std::string &type)
 Print ROOT class information. More...
 

Protected Attributes

TDictionary * dictionary
 pointer to ROOT dictionary More...
 
int offset
 offset with respect to data structure [B] More...
 

Detailed Description

ROOT class for writing object.

Definition at line 593 of file JRootClass.hh.

Member Typedef Documentation

typedef JAddress<const char * > JROOT::JRootAddressableClass< const char * >::JAddress_t
inherited

Definition at line 431 of file JRootClass.hh.

Definition at line 432 of file JRootClass.hh.

Constructor & Destructor Documentation

template<class T >
JROOT::JRootWritableClass::JRootWritableClass ( const T object)
inline

Constructor.

Parameters
objecttemplate object

Definition at line 602 of file JRootClass.hh.

JROOT::JRootWritableClass::JRootWritableClass ( const JRootAddressableClass< const char * > &  rc)
inline

Copy constructor.

Parameters
rcROOT addressable class

Definition at line 612 of file JRootClass.hh.

Member Function Documentation

template<class T >
JROOT::JRootWritableClass::operator const T & ( ) const
inline

Type conversion operator.

Returns
value

Definition at line 623 of file JRootClass.hh.

624  {
625  if (static_cast<const JRootClass&>(*this) == JRootClass(JType<T>())) {
626  return * (const T*) this->getAddress();
627  } else {
628  THROW(JCastException, "JRootWritableClass::operator const T&");
629  }
630  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
JRootClass()
Default constructor.
Definition: JRootClass.hh:324
pointer_type getAddress() const
Get address.
Definition: JRootClass.hh:451
do set_variable OUTPUT_DIRECTORY $WORKDIR T
pointer_type JROOT::JRootAddressableClass< const char * >::getAddress ( ) const
inlineinherited

Get address.

Returns
pointer to object

Definition at line 451 of file JRootClass.hh.

452  {
453  return this->address + getOffset();
454  }
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:174
bool JROOT::JRootAddressableClass< const char * >::is_valid ( ) const
inlineinherited

Check validity of this addressable class.

Returns
true if valid addressable class; else false

Definition at line 462 of file JRootClass.hh.

463  {
464  return (JRootClass::is_valid() && this->address != NULL);
465  }
bool is_valid(const json &js)
Check validity of JSon data.
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::find ( const char *const  name) const
inlineinherited

Find addressable base class or data member with given name within current class.

Parameters
namename of base class or data member
Returns
ROOT addressable class

Definition at line 474 of file JRootClass.hh.

475  {
476  return JRootAddressableClass(JRootClass::find(name), this->address);
477  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:440
JRootClass JROOT::JRootClass::find ( const char *const  name,
const bool  option = true 
) const
inlineinherited

Find base class or data member with given name within current class.

Parameters
namename of base class or data member
optioncase sensitivity
Returns
ROOT class

Definition at line 237 of file JRootClass.hh.

238  {
239  if (name != NULL && strlen(name) != 0) {
240 
241  if (strcmp(getTypename(), name) == 0) {
242  return *this;
243  }
244 
245  if (this->getClass() != NULL) {
246 
247  // check for data member
248 
249  for (std::unique_ptr<TIterator> i(this->getClass()->GetListOfDataMembers(kFALSE)->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
250  if (( option && strcmp (p->GetName(), name) == 0) ||
251  (!option && strcasecmp(p->GetName(), name) == 0)) {
252  return this->get(*p);
253  }
254  }
255 
256  // check for base classes
257 
258  for (std::unique_ptr<TIterator> i(this->getClass()->GetListOfBases()->MakeIterator()); TBaseClass* p = (TBaseClass*) i->Next(); ) {
259 
260  if (is_class(*p) && !is_STLcontainer(*p)) {
261 
262  JRootClass rcs = this->get(*p);
263 
264  rcs = rcs.find(name);
265 
266  if (rcs.is_valid()) {
267  return rcs;
268  }
269  }
270  }
271  }
272  }
273 
274  return JRootClass(); // invalid value
275  }
JRootClass find(const char *const name, const bool option=true) const
Find base class or data member with given name within current class.
Definition: JRootClass.hh:237
static bool is_STLcontainer(const TBaseClass &base_class)
Check if base class is STL container.
Definition: JRootClass.hh:91
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:196
JRootClass()
Default constructor.
Definition: JRootClass.hh:324
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:210
TClass * getClass() const
Get class.
Definition: JRootClass.hh:185
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:41
static bool is_class(const char *const name)
Check name of class against ROOT classes.
Definition: JRootClass.hh:50
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::get ( const TDataMember &  data_member) const
inlineinherited

Get addressable class of given data member.

Parameters
data_memberdata member
Returns
ROOT addressable class

Definition at line 486 of file JRootClass.hh.

487  {
488  return JRootAddressableClass(JRootClass::get(data_member), this->address);
489  }
T get(const JHead &header)
Get object from header.
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:440
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::get ( const TBaseClass &  base_class) const
inlineinherited

Get addressable class of given base class.

Parameters
base_classbase class
Returns
ROOT addressable class

Definition at line 498 of file JRootClass.hh.

499  {
500  return JRootAddressableClass(JRootClass::get(base_class), this->address);
501  }
T get(const JHead &header)
Get object from header.
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:440
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::operator[] ( const char *const  name) const
inlineinherited

Find addressable base class or data member with given name within current class.

Parameters
namename of base class or data member
Returns
ROOT addressable class

Definition at line 510 of file JRootClass.hh.

511  {
512  return this->find(name);
513  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
Definition: JRootClass.hh:474
static bool JROOT::JRootClass::is_class ( const char *const  name)
inlinestaticinherited

Check name of class against ROOT classes.

Parameters
namename of class
Returns
true if name of class corresponds to genuine class; else false

Definition at line 50 of file JRootClass.hh.

51  {
52  return (name != NULL &&
53  strcmp(name, TClass ::Class()->GetName()) != 0 &&
54  strcmp(name, TObject::Class()->GetName()) != 0 &&
55  strcmp(name, "_Rb_tree_node_base") != 0 &&
56  strcmp(name, "fgIsA") != 0 &&
57  strcmp(name, "atomic<TClass*>") != 0);
58  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
static bool JROOT::JRootClass::is_class ( const TBaseClass &  base_class)
inlinestaticinherited

Check base class against ROOT class names.

Parameters
base_classbase class
Returns
true if valid class name; else false

Definition at line 67 of file JRootClass.hh.

68  {
69  return is_class(base_class.GetName());
70  }
static bool is_class(const char *const name)
Check name of class against ROOT classes.
Definition: JRootClass.hh:50
static bool JROOT::JRootClass::is_class ( const TDataMember &  data_member)
inlinestaticinherited

Check data member against ROOT class names.

Parameters
data_memberdata member
Returns
true if valid class name; else false

Definition at line 79 of file JRootClass.hh.

80  {
81  return is_class(data_member.GetTypeName());
82  }
static bool is_class(const char *const name)
Check name of class against ROOT classes.
Definition: JRootClass.hh:50
static bool JROOT::JRootClass::is_STLcontainer ( const TBaseClass &  base_class)
inlinestaticinherited

Check if base class is STL container.

Parameters
base_classbase class
Returns
true if STL congtainer; else false

Definition at line 91 of file JRootClass.hh.

92  {
93  return (const_cast<TBaseClass&>(base_class).IsSTLContainer() != ROOT::kNotSTL);
94  }
static bool JROOT::JRootClass::is_STLcontainer ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is STL container.

Parameters
data_memberdata member
Returns
true if STL congtainer; else false

Definition at line 103 of file JRootClass.hh.

104  {
105  return (const_cast<TDataMember&>(data_member).IsSTLContainer() != ROOT::kNotSTL);
106  }
static bool JROOT::JRootClass::is_STLstring ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is STL string.

Parameters
data_memberdata member
Returns
true if STL string; else false

Definition at line 115 of file JRootClass.hh.

116  {
117  return (strcmp(data_member.GetFullTypeName(), "string") == 0 ||
118  strcmp(data_member.GetFullTypeName(), "const string") == 0);
119  }
static bool JROOT::JRootClass::is_static ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is static.

Parameters
data_memberdata member
Returns
true if static; else false

Definition at line 128 of file JRootClass.hh.

129  {
130  return (data_member.Property() & kIsStatic);
131  }
TDictionary* JROOT::JRootClass::getDictionary ( ) const
inlineinherited

Get dictionary.

Returns
pointer to dictionary

Definition at line 163 of file JRootClass.hh.

164  {
165  return dictionary;
166  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:317
int JROOT::JRootClass::getOffset ( ) const
inlineinherited

Get offset of this class with respect to parent class.

Returns
offset

Definition at line 174 of file JRootClass.hh.

175  {
176  return offset;
177  }
int offset
offset with respect to data structure [B]
Definition: JRootClass.hh:318
TClass* JROOT::JRootClass::getClass ( ) const
inlineinherited

Get class.

Returns
pointer to class

Definition at line 185 of file JRootClass.hh.

186  {
187  return dynamic_cast<TClass*>(dictionary);
188  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:317
const char* JROOT::JRootClass::getTypename ( ) const
inlineinherited

Get type name.

Returns
type name

Definition at line 196 of file JRootClass.hh.

197  {
198  if (dictionary != NULL)
199  return dictionary->GetName();
200  else
201  return NULL;
202  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:317
bool JROOT::JRootClass::equals ( const JRootClass object) const
inlineinherited

Test equality of ROOT classes.

Parameters
objectROOT class
Returns
true if both ROOT classes are same type; else false

Definition at line 222 of file JRootClass.hh.

223  {
224  return (this-> getTypename() != NULL &&
225  object.getTypename() != NULL &&
226  strcmp(this->getTypename(), object.getTypename()) == 0);
227  }
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:196
void JROOT::JRootClass::print ( std::ostream &  out) const
inlineinherited

Print ROOT class information.

Parameters
outoutput stream

Definition at line 309 of file JRootClass.hh.

310  {
311  print(out, getTypename());
312  }
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:309
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:196
void JROOT::JRootClass::print ( std::ostream &  out,
const std::string prefix 
) const
inlineprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
prefixprefix

Definition at line 349 of file JRootClass.hh.

350  {
351  if (this->is_valid()) {
352 
353  print(out, prefix, this->getTypename());
354 
355  if (this->getClass() != NULL) {
356 
357  if (this->getClass()->GetListOfBases() != NULL) {
358 
359  for (std::unique_ptr<TIterator> i(this->getClass()->GetListOfBases()->MakeIterator()); const TBaseClass* p = (const TBaseClass*) i->Next(); ) {
360  if (!is_STLcontainer(*p))
361  this->get(*p).print(out, prefix + "::" + p->GetName());
362  else
363  print(out, prefix + "::" + p->GetName(), this->get(*p).getTypename());
364  }
365  }
366 
367  if (this->getClass()->GetListOfDataMembers(kFALSE) != NULL) {
368 
369  for (std::unique_ptr<TIterator> i(this->getClass()->GetListOfDataMembers(kFALSE)->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
370  if (!is_STLstring(*p) && !is_STLcontainer(*p))
371  this->get(*p).print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName());
372  else
373  print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName(), this->get(*p).getTypename());
374  }
375  }
376  }
377  }
378  }
static bool is_STLcontainer(const TBaseClass &base_class)
Check if base class is STL container.
Definition: JRootClass.hh:91
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:309
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:196
static bool is_STLstring(const TDataMember &data_member)
Check if data member is STL string.
Definition: JRootClass.hh:115
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:210
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
static void JROOT::JRootClass::print ( std::ostream &  out,
const std::string name,
const std::string type 
)
inlinestaticprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
namename
typetype

Definition at line 388 of file JRootClass.hh.

389  {
390  using namespace std;
391 
392  out << name << " " << '(' << type << ')' << endl;
393  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42

Member Data Documentation

TDictionary* JROOT::JRootClass::dictionary
protectedinherited

pointer to ROOT dictionary

Definition at line 317 of file JRootClass.hh.

int JROOT::JRootClass::offset
protectedinherited

offset with respect to data structure [B]

Definition at line 318 of file JRootClass.hh.

pointer_type JROOT::JAddress< const char * >::address
inherited

Definition at line 417 of file JRootClass.hh.


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