Jpp  16.0.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::JRootAddressableClass< JPointer_t > Struct Template Reference

Auxiliary class to manage access to base classes and data members of ROOT class objects. More...

#include <JRootClass.hh>

Inheritance diagram for JROOT::JRootAddressableClass< JPointer_t >:
JROOT::JRootClass JROOT::JAddress< JPointer_t > JLANG::JEquals< JFirst_t, JSecond_t >

Public Types

typedef JAddress< JPointer_t > JAddress_t
 
typedef JAddress_t::pointer_type pointer_type
 

Public Member Functions

template<class T >
 JRootAddressableClass (T &object)
 Constructor. 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

 JRootAddressableClass (const JRootClass &rc, pointer_type address)
 Constructor. More...
 
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

template<class JPointer_t>
struct JROOT::JRootAddressableClass< JPointer_t >

Auxiliary class to manage access to base classes and data members of ROOT class objects.

This class augments the class JRootClass with addressing capabilities.

Definition at line 427 of file JRootClass.hh.

Member Typedef Documentation

template<class JPointer_t>
typedef JAddress<JPointer_t> JROOT::JRootAddressableClass< JPointer_t >::JAddress_t

Definition at line 431 of file JRootClass.hh.

template<class JPointer_t>
typedef JAddress_t::pointer_type JROOT::JRootAddressableClass< JPointer_t >::pointer_type

Definition at line 432 of file JRootClass.hh.

Constructor & Destructor Documentation

template<class JPointer_t>
template<class T >
JROOT::JRootAddressableClass< JPointer_t >::JRootAddressableClass ( T object)
inline

Constructor.

Parameters
objecttemplate object

Definition at line 440 of file JRootClass.hh.

440  :
441  JRootClass(JType<T>()),
442  JAddress_t((pointer_type) &object)
443  {}
JAddress_t::pointer_type pointer_type
Definition: JRootClass.hh:432
JRootClass()
Default constructor.
Definition: JRootClass.hh:320
JAddress< JPointer_t > JAddress_t
Definition: JRootClass.hh:431
template<class JPointer_t>
JROOT::JRootAddressableClass< JPointer_t >::JRootAddressableClass ( const JRootClass rc,
pointer_type  address 
)
inlineprotected

Constructor.

Parameters
rcROOT class
addressaddress

Definition at line 519 of file JRootClass.hh.

519  :
520  JRootClass(rc),
522  {}
pointer_type address
Definition: JRootClass.hh:417
JRootClass()
Default constructor.
Definition: JRootClass.hh:320
JAddress< JPointer_t > JAddress_t
Definition: JRootClass.hh:431

Member Function Documentation

template<class JPointer_t>
pointer_type JROOT::JRootAddressableClass< JPointer_t >::getAddress ( ) const
inline

Get address.

Returns
pointer to object

Definition at line 451 of file JRootClass.hh.

452  {
453  return this->address + getOffset();
454  }
pointer_type address
Definition: JRootClass.hh:417
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:173
template<class JPointer_t>
bool JROOT::JRootAddressableClass< JPointer_t >::is_valid ( ) const
inline

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  }
pointer_type address
Definition: JRootClass.hh:417
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:209
template<class JPointer_t>
JRootAddressableClass JROOT::JRootAddressableClass< JPointer_t >::find ( const char *  name) const
inline

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  {
476  }
pointer_type address
Definition: JRootClass.hh:417
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 find(const char *name) const
Find base class or data member with given name within current class.
Definition: JRootClass.hh:234
template<class JPointer_t>
JRootAddressableClass JROOT::JRootAddressableClass< JPointer_t >::get ( const TDataMember &  data_member) const
inline

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  }
pointer_type address
Definition: JRootClass.hh:417
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:440
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:281
template<class JPointer_t>
JRootAddressableClass JROOT::JRootAddressableClass< JPointer_t >::get ( const TBaseClass &  base_class) const
inline

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  }
pointer_type address
Definition: JRootClass.hh:417
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:440
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:281
template<class JPointer_t>
JRootAddressableClass JROOT::JRootAddressableClass< JPointer_t >::operator[] ( const char *  name) const
inline

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.

template<class JPointer_t>
pointer_type JROOT::JAddress< JPointer_t >::address
inherited

Definition at line 417 of file JRootClass.hh.


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