Jpp  16.0.2
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::JRootReadableClass Struct Reference

ROOT class for reading object. More...

#include <JRootClass.hh>

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

Public Types

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

Public Member Functions

template<class T >
 JRootReadableClass (T &object)
 Constructor. More...
 
 JRootReadableClass (const JRootAddressableClass< char * > &rc)
 Copy constructor. More...
 
template<class T >
 operator const T & () const
 Type conversion operator. More...
 
template<class T >
 operator T & ()
 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 *name) const
 Find addressable 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 *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 class_name)
 Check class name against ROOT class names. 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 reading object.

Definition at line 529 of file JRootClass.hh.

Member Typedef Documentation

typedef JAddress<char * > JROOT::JRootAddressableClass< 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::JRootReadableClass::JRootReadableClass ( T object)
inline

Constructor.

Parameters
objecttemplate object

Definition at line 538 of file JRootClass.hh.

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

Copy constructor.

Parameters
rcROOT addressable class

Definition at line 548 of file JRootClass.hh.

Member Function Documentation

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

Type conversion operator.

Returns
value

Definition at line 559 of file JRootClass.hh.

560  {
561  if (static_cast<const JRootClass&>(*this) == JRootClass(JType<T>())) {
562  return * (const T*) this->getAddress();
563  } else {
564  THROW(JCastException, "JRootReadableClass::operator const T&");
565  }
566  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
JRootClass()
Default constructor.
Definition: JRootClass.hh:320
pointer_type getAddress() const
Get address.
Definition: JRootClass.hh:451
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
JROOT::JRootReadableClass::operator T & ( )
inline

Type conversion operator.

Returns
value

Definition at line 575 of file JRootClass.hh.

576  {
577  if (static_cast<const JRootClass&>(*this) == JRootClass(JType<T>())) {
578  return * (T*) this->getAddress();
579  } else {
580  THROW(JCastException, "JRootReadableClass::operator T&");
581  }
582  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
JRootClass()
Default constructor.
Definition: JRootClass.hh:320
pointer_type getAddress() const
Get address.
Definition: JRootClass.hh:451
do set_variable OUTPUT_DIRECTORY $WORKDIR T
pointer_type JROOT::JRootAddressableClass< 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:173
bool JROOT::JRootAddressableClass< 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< char * >::find ( const char *  name) const
inlineinherited

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

Parameters
namename of base class or data member

Definition at line 473 of file JRootClass.hh.

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

Get addressable class of given data member.

Parameters
data_memberdata member

Definition at line 484 of file JRootClass.hh.

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

Get addressable class of given base class.

Parameters
base_classbase class

Definition at line 495 of file JRootClass.hh.

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

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

Parameters
namename of base class or data member

Definition at line 506 of file JRootClass.hh.

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

Check class name against ROOT class names.

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

Definition at line 49 of file JRootClass.hh.

50  {
51  return (class_name != NULL &&
52  strcmp(class_name, TClass ::Class()->GetName()) != 0 &&
53  strcmp(class_name, TObject::Class()->GetName()) != 0 &&
54  strcmp(class_name, "_Rb_tree_node_base") != 0 &&
55  strcmp(class_name, "fgIsA") != 0 &&
56  strcmp(class_name, "atomic<TClass*>") != 0);
57  }
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 66 of file JRootClass.hh.

67  {
68  return is_class(base_class.GetName());
69  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:49
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 78 of file JRootClass.hh.

79  {
80  return is_class(data_member.GetTypeName());
81  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:49
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 90 of file JRootClass.hh.

91  {
92  return (const_cast<TBaseClass&>(base_class).IsSTLContainer() != ROOT::kNotSTL);
93  }
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 102 of file JRootClass.hh.

103  {
104  return (const_cast<TDataMember&>(data_member).IsSTLContainer() != ROOT::kNotSTL);
105  }
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 114 of file JRootClass.hh.

115  {
116  return (strcmp(data_member.GetFullTypeName(), "string") == 0 ||
117  strcmp(data_member.GetFullTypeName(), "const string") == 0);
118  }
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 127 of file JRootClass.hh.

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

Get dictionary.

Returns
pointer to dictionary

Definition at line 162 of file JRootClass.hh.

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

Get offset of this class with respect to parent class.

Returns
offset

Definition at line 173 of file JRootClass.hh.

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

Get class.

Returns
pointer to class

Definition at line 184 of file JRootClass.hh.

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

Get type name.

Returns
type name

Definition at line 195 of file JRootClass.hh.

196  {
197  if (dictionary != NULL)
198  return dictionary->GetName();
199  else
200  return NULL;
201  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:313
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 221 of file JRootClass.hh.

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

Print ROOT class information.

Parameters
outoutput stream

Definition at line 305 of file JRootClass.hh.

306  {
307  print(out, getTypename());
308  }
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:305
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:195
void JROOT::JRootClass::print ( std::ostream &  out,
const std::string &  prefix 
) const
inlineprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
prefixprefix

Definition at line 345 of file JRootClass.hh.

346  {
347  if (this->is_valid()) {
348 
349  print(out, prefix, this->getTypename());
350 
351  if (this->getClass() != NULL) {
352 
353  if (this->getClass()->GetListOfBases() != NULL) {
354 
355  TIterator* i = this->getClass()->GetListOfBases()->MakeIterator();
356 
357  for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
358  if (!is_STLcontainer(*p))
359  this->get(*p).print(out, prefix + "::" + p->GetName());
360  else
361  print(out, prefix + "::" + p->GetName(), this->get(*p).getTypename());
362  }
363  }
364 
365  if (this->getClass()->GetListOfDataMembers() != NULL) {
366 
367  TIterator* i = this->getClass()->GetListOfDataMembers()->MakeIterator();
368 
369  for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
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:90
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:305
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:195
static bool is_STLstring(const TDataMember &data_member)
Check if data member is STL string.
Definition: JRootClass.hh:114
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:209
TClass * getClass() const
Get class.
Definition: JRootClass.hh:184
static bool is_static(const TDataMember &data_member)
Check if data member is static.
Definition: JRootClass.hh:127
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 313 of file JRootClass.hh.

int JROOT::JRootClass::offset
protectedinherited

offset with respect to data structure [B]

Definition at line 314 of file JRootClass.hh.

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

Definition at line 417 of file JRootClass.hh.


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