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 41 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 50 of file JRootClass.hh.
50 :
51 dictionary(TDictionary::GetDictionary(
typeid(JType_t))),
53 {}
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 62 of file JRootClass.hh.
62 :
63 dictionary(TDictionary::GetDictionary(
typeid(JType_t))),
64 offset((
char*) &(((JClass_t*) NULL)->*pd) - (
char*) NULL)
65 {}
◆ JRootClass() [3/4]
JROOT::JRootClass::JRootClass |
( |
TDictionary * | dictionary, |
|
|
int | offset = 0 ) |
|
inline |
Constructor.
- Parameters
-
dictionary | pointer to dictionary |
offset | offset |
Definition at line 74 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 86 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 97 of file JRootClass.hh.
◆ getClass()
TClass * JROOT::JRootClass::getClass |
( |
| ) |
const |
|
inline |
Get class.
- Returns
- pointer to class
Definition at line 108 of file JRootClass.hh.
◆ getTypename()
const char * JROOT::JRootClass::getTypename |
( |
| ) |
const |
|
inline |
Get type name.
- Returns
- type name
Definition at line 119 of file JRootClass.hh.
120 {
123 else
124 return NULL;
125 }
◆ is_valid()
bool JROOT::JRootClass::is_valid |
( |
| ) |
const |
|
inline |
Check validity of this class.
- Returns
- true if valid class; else false
Definition at line 133 of file JRootClass.hh.
134 {
136 }
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 145 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 160 of file JRootClass.hh.
161 {
162 if (name != NULL && strlen(name) != 0) {
163
165 return *this;
166 }
167
169
170
171
172 for (TIter next(this->
getClass()->GetListOfDataMembers(kFALSE));
const TDataMember *p = (
const TDataMember*) next(); ) {
173 if (( option && strcmp (p->GetName(), name) == 0) ||
174 (!option && strcasecmp(p->GetName(), name) == 0)) {
175 return this->
get(*p);
176 }
177 }
178
179
180
181 for (TIter next(this->
getClass()->GetListOfBases());
const TBaseClass *p = (
const TBaseClass*) next(); ) {
182
184
186
187 rcs = rcs.find(name, option);
188
189 if (rcs.is_valid()) {
190 return rcs;
191 }
192 }
193 }
194 }
195 }
196
198 }
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 207 of file JRootClass.hh.
208 {
209 return JRootClass(TDictionary::GetDictionary(
object.GetTypeName()),
211 }
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 220 of file JRootClass.hh.
221 {
222 return JRootClass(TDictionary::GetDictionary(
object.GetName()),
223 this->
getOffset() +
const_cast<TBaseClass&
>(
object).GetDelta());
224 }
◆ print() [1/3]
void JROOT::JRootClass::print |
( |
std::ostream & | out | ) |
const |
|
inline |
Print ROOT class information.
- Parameters
-
Definition at line 232 of file JRootClass.hh.
233 {
235 }
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 259 of file JRootClass.hh.
260 {
262
264
266
267 for (TIter next(this->
getClass()->GetListOfBases());
const TBaseClass *p = (
const TBaseClass*) next(); ) {
269 this->
get(*p).
print(out, prefix +
"::" + p->GetName());
270 else
271 print(out, prefix +
"::" + p->GetName(), this->get(*p).getTypename());
272 }
273
274 for (TIter next(this->
getClass()->GetListOfDataMembers(kFALSE));
const TDataMember *p = (
const TDataMember*) next(); ) {
277 else
278 print(out, prefix + (
JRoot::is_static(*p) ?
"::" :
".") + p->GetName(), this->get(*p).getTypename());
279 }
280 }
281 }
282 }
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 292 of file JRootClass.hh.
293 {
295
296 out << name << " " << '(' << type << ')' << endl;
297 }
◆ dictionary
TDictionary* JROOT::JRootClass::dictionary |
|
protected |
◆ offset
int JROOT::JRootClass::offset |
|
protected |
offset with respect to data structure [B]
Definition at line 241 of file JRootClass.hh.
The documentation for this struct was generated from the following file: