Jpp - 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 426 of file JRootClass.hh.

Member Typedef Documentation

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

Definition at line 430 of file JRootClass.hh.

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

Definition at line 431 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 439 of file JRootClass.hh.

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

Constructor.

Parameters
rcROOT class
addressaddress

Definition at line 518 of file JRootClass.hh.

518  :
519  JRootClass(rc),
521  {}
pointer_type address
Definition: JRootClass.hh:416
JRootClass()
Default constructor.
Definition: JRootClass.hh:319
JAddress< JPointer_t > JAddress_t
Definition: JRootClass.hh:430

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 450 of file JRootClass.hh.

451  {
452  return this->address + getOffset();
453  }
pointer_type address
Definition: JRootClass.hh:416
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:172
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 461 of file JRootClass.hh.

462  {
463  return (JRootClass::is_valid() && this->address != NULL);
464  }
pointer_type address
Definition: JRootClass.hh:416
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:208
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 472 of file JRootClass.hh.

473  {
475  }
pointer_type address
Definition: JRootClass.hh:416
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:40
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:439
JRootClass find(const char *name) const
Find base class or data member with given name within current class.
Definition: JRootClass.hh:233
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 483 of file JRootClass.hh.

484  {
485  return JRootAddressableClass(JRootClass::get(data_member), this->address);
486  }
pointer_type address
Definition: JRootClass.hh:416
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:439
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:280
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 494 of file JRootClass.hh.

495  {
496  return JRootAddressableClass(JRootClass::get(base_class), this->address);
497  }
pointer_type address
Definition: JRootClass.hh:416
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:439
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:280
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 505 of file JRootClass.hh.

506  {
507  return this->find(name);
508  }
JRootAddressableClass find(const char *name) const
Find addressable base class or data member with given name within current class.
Definition: JRootClass.hh:472
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:40
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 48 of file JRootClass.hh.

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

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

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

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

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

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

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

Get dictionary.

Returns
pointer to dictionary

Definition at line 161 of file JRootClass.hh.

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

Get offset of this class with respect to parent class.

Returns
offset

Definition at line 172 of file JRootClass.hh.

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

Get class.

Returns
pointer to class

Definition at line 183 of file JRootClass.hh.

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

Get type name.

Returns
type name

Definition at line 194 of file JRootClass.hh.

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

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

Print ROOT class information.

Parameters
outoutput stream

Definition at line 304 of file JRootClass.hh.

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

Print ROOT class information.

Parameters
outoutput stream
prefixprefix

Definition at line 344 of file JRootClass.hh.

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

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

Member Data Documentation

TDictionary* JROOT::JRootClass::dictionary
protectedinherited

pointer to ROOT dictionary

Definition at line 312 of file JRootClass.hh.

int JROOT::JRootClass::offset
protectedinherited

offset with respect to data structure [B]

Definition at line 313 of file JRootClass.hh.

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

Definition at line 416 of file JRootClass.hh.


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