ROOT class for writing from object.
More...
#include <JRootClass.hh>
|
typedef const char * | pointer_type |
| Type definition of address.
|
|
|
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.
|
|
ROOT class for writing from object.
Definition at line 608 of file JRootClass.hh.
◆ pointer_type
◆ JRootWritableClass() [1/4]
JROOT::JRootWritableClass::JRootWritableClass |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 614 of file JRootClass.hh.
614 :
615 JRootAddressableClass<const char *>()
616 {}
◆ JRootWritableClass() [2/4]
template<class T >
JROOT::JRootWritableClass::JRootWritableClass |
( |
const T & | object | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 625 of file JRootClass.hh.
625 :
626 JRootAddressableClass<const char *>(object)
627 {}
◆ JRootWritableClass() [3/4]
Copy constructor.
- Parameters
-
Definition at line 635 of file JRootClass.hh.
635 :
636 JRootAddressableClass<const char *>(rc)
637 {}
◆ JRootWritableClass() [4/4]
JROOT::JRootWritableClass::JRootWritableClass |
( |
TDictionary * | dictionary, |
|
|
pointer_type | address ) |
|
inline |
Constructor.
- Parameters
-
dictionary | pointer to dictionary |
address | address |
Definition at line 646 of file JRootClass.hh.
646 :
648 {}
TDictionary * dictionary
pointer to ROOT dictionary
JRootClass()
Default constructor.
◆ operator const T &()
template<class T >
JROOT::JRootWritableClass::operator const T & |
( |
| ) |
const |
|
inline |
Type conversion operator.
- Returns
- value
Definition at line 657 of file JRootClass.hh.
658 {
661 } else {
662 THROW(JCastException,
"JRootWritableClass::operator const T&");
663 }
664 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
pointer_type getAddress() const
◆ getAddress()
Get address.
- Returns
- pointer to object
Definition at line 408 of file JRootClass.hh.
409 {
411 }
int getOffset() const
Get offset of this class with respect to parent class.
◆ is_valid()
Check validity of this addressable class.
- Returns
- true if valid addressable class; else false
Definition at line 419 of file JRootClass.hh.
420 {
422 }
bool is_valid() const
Check validity of this class.
◆ find() [1/2]
Find addressable base class or data member with given name within current class.
- Parameters
-
name | name of base class or data member |
- Returns
- ROOT addressable class
Definition at line 431 of file JRootClass.hh.
432 {
434 }
JRootClass find(const char *const name, const bool option=true) const
Find base class or data member with given name within current class.
◆ find() [2/2]
JRootClass JROOT::JRootClass::find |
( |
const char *const | name, |
|
|
const bool | option = true ) const |
|
inlineinherited |
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 }
const char * getTypename() const
Get type name.
TClass * getClass() const
Get class.
JRootClass get(const TDataMember &object) const
Get ROOT class of given data member.
static bool is_class(const char *const name)
Check name of class against internal ROOT class names.
static bool is_STLcontainer(const TBaseClass &object)
Check if base class is STL container.
◆ get() [1/2]
Get addressable class of given data member.
- Parameters
-
- Returns
- ROOT addressable class
Definition at line 443 of file JRootClass.hh.
444 {
446
447 if (object.IsaPointer()) {
448
449 char* po = NULL;
450
451 memcpy(&po, this->
getAddress() +
object.GetOffset(),
sizeof(
char*));
452
454
455 } else if (strstr(object.GetTypeName(), "unique_ptr") != NULL) {
456
457 char* po = NULL;
458
459 memcpy(&po, this->
getAddress() +
object.GetOffset(),
sizeof(
char*));
460
461 string buffer(object.GetTypeName());
462
463 const string::size_type il = buffer.find_first_of("<");
464 const string::size_type ir = buffer.find_first_of(">,");
465
466 buffer = buffer.substr(il + 1, ir - il - 1);
467
469
470 } else {
471
473 }
474 }
◆ get() [2/2]
Get addressable class of given base class.
- Parameters
-
- Returns
- ROOT addressable class
Definition at line 483 of file JRootClass.hh.
◆ operator[]()
Find addressable base class or data member with given name within current class.
- Parameters
-
name | name of base class or data member |
- Returns
- ROOT addressable class
Definition at line 495 of file JRootClass.hh.
496 {
497 return this->
find(name);
498 }
JRootAddressableClass find(const char *const name) const
◆ getDictionary()
TDictionary * JROOT::JRootClass::getDictionary |
( |
| ) |
const |
|
inlineinherited |
Get dictionary.
- Returns
- pointer to dictionary
Definition at line 86 of file JRootClass.hh.
◆ getOffset()
int JROOT::JRootClass::getOffset |
( |
| ) |
const |
|
inlineinherited |
Get offset of this class with respect to parent class.
- Returns
- offset
Definition at line 97 of file JRootClass.hh.
98 {
100 }
int offset
offset with respect to data structure [B]
◆ getClass()
TClass * JROOT::JRootClass::getClass |
( |
| ) |
const |
|
inlineinherited |
Get class.
- Returns
- pointer to class
Definition at line 108 of file JRootClass.hh.
◆ getTypename()
const char * JROOT::JRootClass::getTypename |
( |
| ) |
const |
|
inlineinherited |
Get type name.
- Returns
- type name
Definition at line 119 of file JRootClass.hh.
120 {
123 else
124 return NULL;
125 }
◆ equals()
bool JROOT::JRootClass::equals |
( |
const JRootClass & | object | ) |
const |
|
inlineinherited |
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.
◆ print() [1/3]
void JROOT::JRootClass::print |
( |
std::ostream & | out | ) |
const |
|
inlineinherited |
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 |
|
inlineprotectedinherited |
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 }
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 ) |
|
inlinestaticprotectedinherited |
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 }
◆ address
◆ dictionary
TDictionary* JROOT::JRootClass::dictionary |
|
protectedinherited |
◆ offset
int JROOT::JRootClass::offset |
|
protectedinherited |
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: