Go to the documentation of this file.    1 #ifndef __JROOT__JROOTCLASS__ 
    2 #define __JROOT__JROOTCLASS__ 
    9 #include <TDictionary.h> 
   11 #include <TDataMember.h> 
   12 #include <TBaseClass.h> 
   13 #include <TIterator.h> 
   26 namespace JPP { 
using namespace JROOT; }
 
   47     static inline bool is_class(
const char* 
const class_name)
 
   49       return (class_name                                      != NULL  &&
 
   50               strcmp(class_name, TClass ::Class()->GetName()) != 0     &&
 
   51               strcmp(class_name, TObject::Class()->GetName()) != 0     &&
 
   52               strcmp(class_name, 
"fgIsA")                     != 0     &&
 
   53               strcmp(class_name, 
"atomic<TClass*>")           != 0);
 
   63     static inline bool is_class(
const TBaseClass& base_class)
 
   65       return is_class(base_class.GetName());
 
   75     static inline bool is_class(
const TDataMember& data_member)
 
   77       return is_class(data_member.GetTypeName());
 
   89       return (const_cast<TBaseClass&>(base_class).IsSTLContainer() != ROOT::kNotSTL);
 
  101       return (const_cast<TDataMember&>(data_member).IsSTLContainer() != ROOT::kNotSTL);
 
  113       return (strcmp(data_member.GetFullTypeName(), 
"string")       == 0 ||
 
  114               strcmp(data_member.GetFullTypeName(), 
"const string") == 0);
 
  124     static inline bool is_static(
const TDataMember& data_member)
 
  126       return (data_member.Property() & kIsStatic);
 
  135     template<
class JType_t>
 
  137       dictionary(TDictionary::GetDictionary(typeid(JType_t))),
 
  147     template<
class JType_t, 
class JClass_t>
 
  149       dictionary(TDictionary::GetDictionary(typeid(JType_t))),
 
  150       offset((char*) &(((JClass_t*) NULL)->*pd) - (char*) NULL)
 
  233       if (name != NULL && strlen(name) != 0) {
 
  243           const TDataMember* p = this->
getClass()->GetDataMember(name);
 
  246             return this->
get(*p);
 
  251           TIterator* i = this->
getClass()->GetListOfBases()->MakeIterator();
 
  253           for (TBaseClass* p; (p = (TBaseClass*) i->Next()) != NULL; ) {
 
  259               rcs = rcs.
find(name);
 
  280       return JRootClass(TDictionary::GetDictionary(data_member.GetTypeName()), 
 
  281                         this->
getOffset() + data_member.GetOffset());
 
  292       return JRootClass(TDictionary::GetDictionary(base_class.GetName()),
 
  293                         this->
getOffset() + const_cast<TBaseClass&>(base_class).GetDelta());
 
  302     inline void print(std::ostream& out)
 const 
  342     inline void print(std::ostream& out, 
const std::string& prefix)
 const 
  350           if (this->
getClass()->GetListOfBases() != NULL) {
 
  352             TIterator* i = this->
getClass()->GetListOfBases()->MakeIterator();
 
  354             for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
 
  356                 this->
get(*p).
print(out, prefix + 
"::" + p->GetName());
 
  362           if (this->
getClass()->GetListOfDataMembers() != NULL) {
 
  364             TIterator* i = this->
getClass()->GetListOfDataMembers()->MakeIterator();
 
  366             for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
 
  385     inline static void print(std::ostream& out, 
const std::string& name, 
const std::string& type) 
 
  389       out << name << 
"  " << 
'(' << type << 
')' << endl;
 
  397   template<
class JPo
inter_t>
 
  423   template<
class JPo
inter_t>
 
  505       return this->
find(name);
 
  556     operator const T&() 
const 
  559         return * (
const T*) this->getAddress();
 
  575         return * (T*) this->getAddress();
 
  616     operator const T&() 
const 
  619         return * (
const T*) this->getAddress();
 
  641       i = parent.
getClass()->GetListOfDataMembers()->MakeIterator();
 
  643       for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
 
  652       i = parent.
getClass()->GetListOfBases()->MakeIterator();
 
  654       for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
 
  677   template<
class JType_t, 
class JClass_t>
 
 
JRootWritableClass(const JRootAddressableClass< const char * > &rc)
Copy constructor.
 
bool equals(const JRootClass &object) const
Test equality of ROOT classes.
 
JRootClass(const JType< JType_t > &type)
Constructor.
 
JRootClass()
Default constructor.
 
bool is_valid() const
Check validity of this addressable class.
 
JRootWritableClass(const T &object)
Constructor.
 
Auxiliary class for a type holder.
 
Auxiliary classes and methods for ROOT I/O.
 
pointer_type getAddress() const
Get address.
 
ROOT class for writing object.
 
TClass * getClass() const
Get class.
 
static bool is_class(const TBaseClass &base_class)
Check base class against ROOT class names.
 
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
 
int getOffset() const
Get offset of this class with respect to parent class.
 
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
 
Template definition of auxiliary base class for comparison of data structures.
 
JRootClass(TDictionary *dictionary, int offset)
Constructor.
 
static bool is_STLcontainer(const TBaseClass &base_class)
Check if base class is STL container.
 
Exception for cast operation.
 
JRootAddressableClass operator[](const char *name) const
Find addressable base class or data member with given name within current class.
 
JRootAddressableClass get(const TBaseClass &base_class) const
Get addressable class of given base class.
 
TDictionary * dictionary
pointer to ROOT dictionary
 
static bool is_static(const TDataMember &data_member)
Check if data member is static.
 
JAddress(pointer_type p)
Constructor.
 
JRootClass(JType_t JClass_t::*pd)
Constructor.
 
const TDataMember * getDataMember(JType_t JClass_t::*pd)
Get ROOT data member for given C++ data member.
 
Auxiliary class to manage access to base classes and data members of ROOT class.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
JRootAddressableClass get(const TDataMember &data_member) const
Get addressable class of given data member.
 
JRootAddressableClass(const JRootClass &rc, pointer_type address)
Constructor.
 
JRootReadableClass(const JRootAddressableClass< char * > &rc)
Copy constructor.
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
JPointer_t pointer_type
Type definition of address.
 
Auxiliary class to manage access to base classes and data members of ROOT class objects.
 
JAddress< JPointer_t > JAddress_t
 
int offset
offset with respect to data structure [B]
 
const char * getTypename() const
Get type name.
 
JRootAddressableClass(T &object)
Constructor.
 
TDictionary * getDictionary() const
Get dictionary.
 
JRootReadableClass(T &object)
Constructor.
 
static void print(std::ostream &out, const std::string &name, const std::string &type)
Print ROOT class information.
 
JAddress_t::pointer_type pointer_type
 
static bool is_class(const TDataMember &data_member)
Check data member against ROOT class names.
 
JRootClass get(const TBaseClass &base_class) const
Get ROOT class of given base class.
 
ROOT class for reading object.
 
bool is_valid() const
Check validity of this class.
 
static bool is_STLcontainer(const TDataMember &data_member)
Check if data member is STL container.
 
void print(std::ostream &out, const std::string &prefix) const
Print ROOT class information.
 
static bool is_STLstring(const TDataMember &data_member)
Check if data member is STL string.
 
void print(std::ostream &out) const
Print ROOT class information.
 
JRootAddressableClass find(const char *name) const
Find addressable base class or data member with given name within current class.
 
JRootClass find(const char *name) const
Find base class or data member with given name within current class.
 
JType< T > getType()
Get type.