Auxiliary class to manage access to base classes and data members of ROOT class.
More...
#include <JRootClass.hh>
|
template<class JType_t > |
| JRootClass (const JType< JType_t > &type) |
| Constructor.
|
|
template<class JType_t , class JClass_t > |
| JRootClass (JType_t JClass_t::*pd) |
| Constructor.
|
|
| JRootClass (TDictionary *dictionary, int offset=0) |
| Constructor.
|
|
TDictionary * | getDictionary () const |
| Get dictionary.
|
|
int | getOffset () const |
| Get offset of this class with respect to parent class.
|
|
TClass * | getClass () const |
| Get class.
|
|
const char * | getTypename () const |
| Get type name.
|
|
bool | is_valid () const |
| Check validity of this class.
|
|
bool | equals (const JRootClass &object) const |
| Test equality of ROOT classes.
|
|
JRootClass | find (const char *const name, const bool option=true) const |
| Find base class or data member with given name within current class.
|
|
JRootClass | get (const TDataMember &object) const |
| Get ROOT class of given data member.
|
|
JRootClass | get (const TBaseClass &object) const |
| Get ROOT class of given base class.
|
|
void | print (std::ostream &out) const |
| Print ROOT class information.
|
|
|
| JRootClass () |
| Default constructor.
|
|
void | print (std::ostream &out, const std::string &prefix) const |
| Print ROOT class information.
|
|
|
static void | print (std::ostream &out, const std::string &name, const std::string &type) |
| Print ROOT class information.
|
|
|
TDictionary * | dictionary |
| pointer to ROOT dictionary
|
|
int | offset |
| offset with respect to data structure [B]
|
|
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition at line 42 of file JRootClass.hh.
◆ JRootClass() [1/4]
template<class JType_t >
JROOT::JRootClass::JRootClass |
( |
const JType< JType_t > & | type | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 51 of file JRootClass.hh.
51 :
52 dictionary(TDictionary::GetDictionary(
typeid(JType_t))),
54 {}
TDictionary * dictionary
pointer to ROOT dictionary
int offset
offset with respect to data structure [B]
◆ JRootClass() [2/4]
template<class JType_t , class JClass_t >
JROOT::JRootClass::JRootClass |
( |
JType_t JClass_t::* | pd | ) |
|
|
inline |
Constructor.
- Parameters
-
pd | pointer to C++ data member |
Definition at line 63 of file JRootClass.hh.
63 :
64 dictionary(TDictionary::GetDictionary(
typeid(JType_t))),
65 offset((
char*) &(((JClass_t*) NULL)->*pd) - (
char*) NULL)
66 {}
◆ JRootClass() [3/4]
JROOT::JRootClass::JRootClass |
( |
TDictionary * | dictionary, |
|
|
int | offset = 0 ) |
|
inline |
Constructor.
- Parameters
-
dictionary | pointer to dictionary |
offset | offset |
Definition at line 75 of file JRootClass.hh.
◆ JRootClass() [4/4]
JROOT::JRootClass::JRootClass |
( |
| ) |
|
|
inlineprotected |
◆ getDictionary()
TDictionary * JROOT::JRootClass::getDictionary |
( |
| ) |
const |
|
inline |
Get dictionary.
- Returns
- pointer to dictionary
Definition at line 87 of file JRootClass.hh.
◆ getOffset()
int JROOT::JRootClass::getOffset |
( |
| ) |
const |
|
inline |
Get offset of this class with respect to parent class.
- Returns
- offset
Definition at line 98 of file JRootClass.hh.
◆ getClass()
TClass * JROOT::JRootClass::getClass |
( |
| ) |
const |
|
inline |
Get class.
- Returns
- pointer to class
Definition at line 109 of file JRootClass.hh.
◆ getTypename()
const char * JROOT::JRootClass::getTypename |
( |
| ) |
const |
|
inline |
Get type name.
- Returns
- type name
Definition at line 120 of file JRootClass.hh.
121 {
124 else
125 return NULL;
126 }
◆ is_valid()
bool JROOT::JRootClass::is_valid |
( |
| ) |
const |
|
inline |
Check validity of this class.
- Returns
- true if valid class; else false
Definition at line 134 of file JRootClass.hh.
135 {
137 }
TDictionary * getDictionary() const
Get dictionary.
const char * getTypename() const
Get type name.
static bool is_class(const char *const name)
Check name of class against internal ROOT class names.
◆ equals()
bool JROOT::JRootClass::equals |
( |
const JRootClass & | object | ) |
const |
|
inline |
Test equality of ROOT classes.
- Parameters
-
- Returns
- true if both ROOT classes are same type; else false
Definition at line 146 of file JRootClass.hh.
◆ find()
JRootClass JROOT::JRootClass::find |
( |
const char *const | name, |
|
|
const bool | option = true ) const |
|
inline |
Find base class or data member with given name within current class.
- Parameters
-
name | name of base class or data member |
option | case insensitive |
- Returns
- ROOT class
Definition at line 161 of file JRootClass.hh.
162 {
163 if (name != NULL && strlen(name) != 0) {
164
166 return *this;
167 }
168
170
171
172
173 for (TIter next(this->
getClass()->GetListOfDataMembers(kFALSE));
const TDataMember *p = (
const TDataMember*) next(); ) {
174 if (( option && strcmp (p->GetName(), name) == 0) ||
175 (!option && strcasecmp(p->GetName(), name) == 0)) {
176 return this->
get(*p);
177 }
178 }
179
180
181
182 for (TIter next(this->
getClass()->GetListOfBases());
const TBaseClass *p = (
const TBaseClass*) next(); ) {
183
185
187
188 rcs = rcs.find(name, option);
189
190 if (rcs.is_valid()) {
191 return rcs;
192 }
193 }
194 }
195 }
196 }
197
199 }
JRootClass()
Default constructor.
TClass * getClass() const
Get class.
JRootClass get(const TDataMember &object) const
Get ROOT class of given data member.
static bool is_STLcontainer(const TBaseClass &object)
Check if base class is STL container.
◆ get() [1/2]
JRootClass JROOT::JRootClass::get |
( |
const TDataMember & | object | ) |
const |
|
inline |
Get ROOT class of given data member.
- Parameters
-
- Returns
- ROOT class
Definition at line 208 of file JRootClass.hh.
209 {
210 return JRootClass(TDictionary::GetDictionary(
object.GetTypeName()),
212 }
int getOffset() const
Get offset of this class with respect to parent class.
◆ get() [2/2]
JRootClass JROOT::JRootClass::get |
( |
const TBaseClass & | object | ) |
const |
|
inline |
Get ROOT class of given base class.
- Parameters
-
- Returns
- ROOT class
Definition at line 221 of file JRootClass.hh.
222 {
223 return JRootClass(TDictionary::GetDictionary(
object.GetName()),
224 this->
getOffset() +
const_cast<TBaseClass&
>(
object).GetDelta());
225 }
◆ print() [1/3]
void JROOT::JRootClass::print |
( |
std::ostream & | out | ) |
const |
|
inline |
Print ROOT class information.
- Parameters
-
Definition at line 233 of file JRootClass.hh.
234 {
236 }
void print(std::ostream &out) const
Print ROOT class information.
◆ print() [2/3]
void JROOT::JRootClass::print |
( |
std::ostream & | out, |
|
|
const std::string & | prefix ) const |
|
inlineprotected |
Print ROOT class information.
- Parameters
-
out | output stream |
prefix | prefix |
Definition at line 260 of file JRootClass.hh.
261 {
263
265
267
268 for (TIter next(this->
getClass()->GetListOfBases());
const TBaseClass *p = (
const TBaseClass*) next(); ) {
270 this->
get(*p).
print(out, prefix +
"::" + p->GetName());
271 else
272 print(out, prefix +
"::" + p->GetName(), this->get(*p).getTypename());
273 }
274
275 for (TIter next(this->
getClass()->GetListOfDataMembers(kFALSE));
const TDataMember *p = (
const TDataMember*) next(); ) {
278 else
279 print(out, prefix + (
JRoot::is_static(*p) ?
"::" :
".") + p->GetName(), this->get(*p).getTypename());
280 }
281 }
282 }
283 }
bool is_valid() const
Check validity of this class.
static bool is_static(const TDataMember &object)
Check if data member is static.
static bool is_STLstring(const TDataMember &object)
Check if data member is STL string.
◆ print() [3/3]
static void JROOT::JRootClass::print |
( |
std::ostream & | out, |
|
|
const std::string & | name, |
|
|
const std::string & | type ) |
|
inlinestaticprotected |
Print ROOT class information.
- Parameters
-
out | output stream |
name | name |
type | type |
Definition at line 293 of file JRootClass.hh.
294 {
296
297 out << name << " " << '(' << type << ')' << endl;
298 }
◆ dictionary
TDictionary* JROOT::JRootClass::dictionary |
|
protected |
◆ offset
int JROOT::JRootClass::offset |
|
protected |
offset with respect to data structure [B]
Definition at line 242 of file JRootClass.hh.
The documentation for this struct was generated from the following file: