Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
JROOT::JRootAddressableClass< is_const > 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< is_const >:
JROOT::JRootClass JLANG::JAddress< is_const >

Public Types

typedef JAddress< is_const > 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...
 
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...
 
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...
 

Protected Member Functions

 JRootAddressableClass (const JRootClass &rcs, 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...
 
pointer_type address
 

Detailed Description

template<bool is_const>
struct JROOT::JRootAddressableClass< is_const >

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

Definition at line 386 of file JRootClass.hh.

Member Typedef Documentation

template<bool is_const>
typedef JAddress<is_const> JROOT::JRootAddressableClass< is_const >::JAddress_t

Definition at line 390 of file JRootClass.hh.

template<bool is_const>
typedef JAddress_t::pointer_type JROOT::JRootAddressableClass< is_const >::pointer_type

Definition at line 391 of file JRootClass.hh.

Constructor & Destructor Documentation

template<bool is_const>
template<class T >
JROOT::JRootAddressableClass< is_const >::JRootAddressableClass ( T &  object)
inline

Constructor.

Parameters
objecttemplate object

Definition at line 400 of file JRootClass.hh.

400  :
401  JRootClass(JType<T>()),
402  JAddress_t((pointer_type) &object)
403  {}
JRootClass()
Default constructor.
Definition: JRootClass.hh:305
JAddress< is_const > JAddress_t
Definition: JRootClass.hh:390
JAddress_t::pointer_type pointer_type
Definition: JRootClass.hh:391
template<bool is_const>
JROOT::JRootAddressableClass< is_const >::JRootAddressableClass ( const JRootClass rcs,
pointer_type  address 
)
inlineprotected

Constructor.

Parameters
rcsROOT class
addressaddress

Definition at line 468 of file JRootClass.hh.

468  :
469  JRootClass(rcs),
471  {}
JRootClass()
Default constructor.
Definition: JRootClass.hh:305
JAddress< is_const > JAddress_t
Definition: JRootClass.hh:390
pointer_type address
Definition: JAddress.hh:60

Member Function Documentation

template<bool is_const>
pointer_type JROOT::JRootAddressableClass< is_const >::getAddress ( ) const
inline

Get address.

Returns
pointer to object

Definition at line 411 of file JRootClass.hh.

412  {
413  return this->address + getOffset();
414  }
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:156
pointer_type address
Definition: JAddress.hh:60
template<bool is_const>
bool JROOT::JRootAddressableClass< is_const >::is_valid ( ) const
inline

Check validity of this addressable class.

Returns
true if valid addressable class; else false

Definition at line 422 of file JRootClass.hh.

423  {
424  return (JRootClass::is_valid() && this->address != NULL);
425  }
pointer_type address
Definition: JAddress.hh:60
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:192
template<bool is_const>
JRootAddressableClass JROOT::JRootAddressableClass< is_const >::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 433 of file JRootClass.hh.

434  {
435  return JRootAddressableClass(JRootClass::find(name), this->address);
436  }
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:400
pointer_type address
Definition: JAddress.hh:60
JRootClass find(const char *name) const
Find base class or data member with given name within current class.
Definition: JRootClass.hh:219
template<bool is_const>
JRootAddressableClass JROOT::JRootAddressableClass< is_const >::get ( const TDataMember &  data_member) const
inline

Get addressable class of given data member.

Parameters
data_memberdata member

Definition at line 444 of file JRootClass.hh.

445  {
446  return JRootAddressableClass(JRootClass::get(data_member), this->address);
447  }
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:400
pointer_type address
Definition: JAddress.hh:60
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:266
template<bool is_const>
JRootAddressableClass JROOT::JRootAddressableClass< is_const >::get ( const TBaseClass &  base_class) const
inline

Get addressable class of given base class.

Parameters
base_classbase class

Definition at line 455 of file JRootClass.hh.

456  {
457  return JRootAddressableClass(JRootClass::get(base_class), this->address);
458  }
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:400
pointer_type address
Definition: JAddress.hh:60
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:266
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 45 of file JRootClass.hh.

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

62  {
63  return is_class(base_class.GetName());
64  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:45
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 73 of file JRootClass.hh.

74  {
75  return is_class(data_member.GetTypeName());
76  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:45
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 85 of file JRootClass.hh.

86  {
87  return (const_cast<TBaseClass&>(base_class).IsSTLContainer() != ROOT::kNotSTL);
88  }
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 97 of file JRootClass.hh.

98  {
99  return (const_cast<TDataMember&>(data_member).IsSTLContainer() != ROOT::kNotSTL);
100  }
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 109 of file JRootClass.hh.

110  {
111  return (strcmp(data_member.GetFullTypeName(), "string") == 0 ||
112  strcmp(data_member.GetFullTypeName(), "const string") == 0);
113  }
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 122 of file JRootClass.hh.

123  {
124  return (data_member.Property() & kIsStatic);
125  }
TDictionary* JROOT::JRootClass::getDictionary ( ) const
inlineinherited

Get dictionary.

Returns
pointer to dictionary

Definition at line 145 of file JRootClass.hh.

146  {
147  return dictionary;
148  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:298
int JROOT::JRootClass::getOffset ( ) const
inlineinherited

Get offset of this class with respect to parent class.

Returns
offset

Definition at line 156 of file JRootClass.hh.

157  {
158  return offset;
159  }
int offset
offset with respect to data structure [B]
Definition: JRootClass.hh:299
TClass* JROOT::JRootClass::getClass ( ) const
inlineinherited

Get class.

Returns
pointer to class

Definition at line 167 of file JRootClass.hh.

168  {
169  return dynamic_cast<TClass*>(dictionary);
170  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:298
const char* JROOT::JRootClass::getTypename ( ) const
inlineinherited

Get type name.

Returns
type name

Definition at line 178 of file JRootClass.hh.

179  {
180  if (dictionary != NULL)
181  return dictionary->GetName();
182  else
183  return NULL;
184  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:298
void JROOT::JRootClass::print ( std::ostream &  out) const
inlineinherited

Print ROOT class information.

Parameters
outoutput stream

Definition at line 290 of file JRootClass.hh.

291  {
292  print(out, getTypename());
293  }
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:290
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:178
void JROOT::JRootClass::print ( std::ostream &  out,
const std::string &  prefix 
) const
inlineprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
prefixprefix

Definition at line 330 of file JRootClass.hh.

331  {
332  if (this->is_valid()) {
333 
334  print(out, prefix, this->getTypename());
335 
336  if (this->getClass() != NULL) {
337 
338  if (this->getClass()->GetListOfBases() != NULL) {
339 
340  TIterator* i = this->getClass()->GetListOfBases()->MakeIterator();
341 
342  for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
343  if (!is_STLcontainer(*p))
344  this->get(*p).print(out, prefix + "::" + p->GetName());
345  else
346  print(out, prefix + "::" + p->GetName(), this->get(*p).getTypename());
347  }
348  }
349 
350  if (this->getClass()->GetListOfDataMembers() != NULL) {
351 
352  TIterator* i = this->getClass()->GetListOfDataMembers()->MakeIterator();
353 
354  for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
355  if (!is_STLstring(*p) && !is_STLcontainer(*p))
356  this->get(*p).print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName());
357  else
358  print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName(), this->get(*p).getTypename());
359  }
360  }
361  }
362  }
363  }
static bool is_STLcontainer(const TBaseClass &base_class)
Check if base class is STL container.
Definition: JRootClass.hh:85
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:290
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:178
static bool is_STLstring(const TDataMember &data_member)
Check if data member is STL string.
Definition: JRootClass.hh:109
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:192
TClass * getClass() const
Get class.
Definition: JRootClass.hh:167
static bool is_static(const TDataMember &data_member)
Check if data member is static.
Definition: JRootClass.hh:122
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 373 of file JRootClass.hh.

374  {
375  using namespace std;
376 
377  out << name << " " << '(' << type << ')' << endl;
378  }

Member Data Documentation

TDictionary* JROOT::JRootClass::dictionary
protectedinherited

pointer to ROOT dictionary

Definition at line 298 of file JRootClass.hh.

int JROOT::JRootClass::offset
protectedinherited

offset with respect to data structure [B]

Definition at line 299 of file JRootClass.hh.

template<bool is_const>
pointer_type JLANG::JAddress< is_const >::address
protectedinherited

Definition at line 60 of file JAddress.hh.


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