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 609 of file JRootClass.hh.
◆ pointer_type
◆ JRootWritableClass() [1/4]
JROOT::JRootWritableClass::JRootWritableClass |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 615 of file JRootClass.hh.
615 :
616 JRootAddressableClass<const char *>()
617 {}
◆ JRootWritableClass() [2/4]
template<class T >
JROOT::JRootWritableClass::JRootWritableClass |
( |
const T & | object | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 626 of file JRootClass.hh.
626 :
627 JRootAddressableClass<const char *>(object)
628 {}
◆ JRootWritableClass() [3/4]
Copy constructor.
- Parameters
-
Definition at line 636 of file JRootClass.hh.
636 :
637 JRootAddressableClass<const char *>(rc)
638 {}
◆ JRootWritableClass() [4/4]
JROOT::JRootWritableClass::JRootWritableClass |
( |
TDictionary * | dictionary, |
|
|
pointer_type | address ) |
|
inline |
Constructor.
- Parameters
-
dictionary | pointer to dictionary |
address | address |
Definition at line 647 of file JRootClass.hh.
647 :
649 {}
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 658 of file JRootClass.hh.
659 {
662 } else {
663 THROW(JCastException,
"JRootWritableClass::operator const T&");
664 }
665 }
#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 409 of file JRootClass.hh.
410 {
412 }
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 420 of file JRootClass.hh.
421 {
423 }
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 432 of file JRootClass.hh.
433 {
435 }
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 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 }
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 444 of file JRootClass.hh.
445 {
447
448 if (object.IsaPointer()) {
449
450 char* po = NULL;
451
452 memcpy(&po, this->
getAddress() +
object.GetOffset(),
sizeof(
char*));
453
455
456 } else if (strstr(object.GetTypeName(), "unique_ptr") != NULL) {
457
458 char* po = NULL;
459
460 memcpy(&po, this->
getAddress() +
object.GetOffset(),
sizeof(
char*));
461
462 string buffer(object.GetTypeName());
463
464 const string::size_type il = buffer.find_first_of("<");
465 const string::size_type ir = buffer.find_first_of(">,");
466
467 buffer = buffer.substr(il + 1, ir - il - 1);
468
470
471 } else {
472
474 }
475 }
◆ get() [2/2]
Get addressable class of given base class.
- Parameters
-
- Returns
- ROOT addressable class
Definition at line 484 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 496 of file JRootClass.hh.
497 {
498 return this->
find(name);
499 }
JRootAddressableClass find(const char *const name) const
◆ getDictionary()
TDictionary * JROOT::JRootClass::getDictionary |
( |
| ) |
const |
|
inlineinherited |
Get dictionary.
- Returns
- pointer to dictionary
Definition at line 87 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 98 of file JRootClass.hh.
99 {
101 }
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 109 of file JRootClass.hh.
◆ getTypename()
const char * JROOT::JRootClass::getTypename |
( |
| ) |
const |
|
inlineinherited |
Get type name.
- Returns
- type name
Definition at line 120 of file JRootClass.hh.
121 {
124 else
125 return NULL;
126 }
◆ 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 146 of file JRootClass.hh.
◆ print() [1/3]
void JROOT::JRootClass::print |
( |
std::ostream & | out | ) |
const |
|
inlineinherited |
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 |
|
inlineprotectedinherited |
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 }
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 293 of file JRootClass.hh.
294 {
296
297 out << name << " " << '(' << type << ')' << endl;
298 }
◆ address
◆ dictionary
TDictionary* JROOT::JRootClass::dictionary |
|
protectedinherited |
◆ offset
int JROOT::JRootClass::offset |
|
protectedinherited |
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: