Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
JROOT::JRootWritableClass Struct Reference

ROOT class for writing object. More...

#include <JRootClass.hh>

Inheritance diagram for JROOT::JRootWritableClass:
JROOT::JRootAddressableClass< const char * > JROOT::JRootClass JROOT::JAddress< const char * > JLANG::JEquals< JRootClass >

Public Types

typedef JAddress< const char * > JAddress_t
 
typedef JAddress_t::pointer_type pointer_type
 

Public Member Functions

template<class T >
 JRootWritableClass (const T &object)
 Constructor. More...
 
 JRootWritableClass (const JRootAddressableClass< const char * > &rc)
 Copy constructor. More...
 
template<class T >
 operator const T & () const
 Type conversion operator. More...
 
pointer_type getAddress () const
 Get address. More...
 
bool is_valid () const
 Check validity of this addressable class. More...
 
JRootAddressableClass find (const char *name) const
 Find addressable base class or data member with given name within current class. More...
 
JRootAddressableClass get (const TDataMember &data_member) const
 Get addressable class of given data member. More...
 
JRootAddressableClass get (const TBaseClass &base_class) const
 Get addressable class of given base class. More...
 
JRootAddressableClass operator[] (const char *name) const
 Find addressable base class or data member with given name within current class. More...
 
TDictionary * getDictionary () const
 Get dictionary. More...
 
int getOffset () const
 Get offset of this class with respect to parent class. More...
 
TClass * getClass () const
 Get class. More...
 
const char * getTypename () const
 Get type name. More...
 
bool equals (const JRootClass &object) const
 Test equality of ROOT classes. More...
 
void print (std::ostream &out) const
 Print ROOT class information. More...
 

Static Public Member Functions

static bool is_class (const char *const class_name)
 Check class name against ROOT class names. More...
 
static bool is_class (const TBaseClass &base_class)
 Check base class against ROOT class names. More...
 
static bool is_class (const TDataMember &data_member)
 Check data member against ROOT class names. More...
 
static bool is_STLcontainer (const TBaseClass &base_class)
 Check if base class is STL container. More...
 
static bool is_STLcontainer (const TDataMember &data_member)
 Check if data member is STL container. More...
 
static bool is_STLstring (const TDataMember &data_member)
 Check if data member is STL string. More...
 
static bool is_static (const TDataMember &data_member)
 Check if data member is static. More...
 

Public Attributes

pointer_type address
 

Protected Member Functions

void print (std::ostream &out, const std::string &prefix) const
 Print ROOT class information. More...
 

Static Protected Member Functions

static void print (std::ostream &out, const std::string &name, const std::string &type)
 Print ROOT class information. More...
 

Protected Attributes

TDictionary * dictionary
 pointer to ROOT dictionary More...
 
int offset
 offset with respect to data structure [B] More...
 

Detailed Description

ROOT class for writing object.

Definition at line 586 of file JRootClass.hh.

Member Typedef Documentation

typedef JAddress<const char * > JROOT::JRootAddressableClass< const char * >::JAddress_t
inherited

Definition at line 428 of file JRootClass.hh.

Definition at line 429 of file JRootClass.hh.

Constructor & Destructor Documentation

template<class T >
JROOT::JRootWritableClass::JRootWritableClass ( const T object)
inline

Constructor.

Parameters
objecttemplate object

Definition at line 595 of file JRootClass.hh.

JROOT::JRootWritableClass::JRootWritableClass ( const JRootAddressableClass< const char * > &  rc)
inline

Copy constructor.

Parameters
rcROOT addressable class

Definition at line 605 of file JRootClass.hh.

Member Function Documentation

template<class T >
JROOT::JRootWritableClass::operator const T & ( ) const
inline

Type conversion operator.

Returns
value

Definition at line 616 of file JRootClass.hh.

617  {
618  if (static_cast<const JRootClass&>(*this) == JRootClass(JType<T>())) {
619  return * (const T*) this->getAddress();
620  } else {
621  THROW(JCastException, "JRootWritableClass::operator const T&");
622  }
623  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
JRootClass()
Default constructor.
Definition: JRootClass.hh:317
pointer_type getAddress() const
Get address.
Definition: JRootClass.hh:448
do set_variable OUTPUT_DIRECTORY $WORKDIR T
pointer_type JROOT::JRootAddressableClass< const char * >::getAddress ( ) const
inlineinherited

Get address.

Returns
pointer to object

Definition at line 448 of file JRootClass.hh.

449  {
450  return this->address + getOffset();
451  }
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:170
bool JROOT::JRootAddressableClass< const char * >::is_valid ( ) const
inlineinherited

Check validity of this addressable class.

Returns
true if valid addressable class; else false

Definition at line 459 of file JRootClass.hh.

460  {
461  return (JRootClass::is_valid() && this->address != NULL);
462  }
bool is_valid(const json &js)
Check validity of JSon data.
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::find ( const char *  name) const
inlineinherited

Find addressable base class or data member with given name within current class.

Parameters
namename of base class or data member

Definition at line 470 of file JRootClass.hh.

471  {
472  return JRootAddressableClass(JRootClass::find(name), this->address);
473  }
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:437
then echo n User name
Definition: JCookie.sh:45
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::get ( const TDataMember &  data_member) const
inlineinherited

Get addressable class of given data member.

Parameters
data_memberdata member

Definition at line 481 of file JRootClass.hh.

482  {
483  return JRootAddressableClass(JRootClass::get(data_member), this->address);
484  }
T get(const JHead &header)
Get object from header.
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:437
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::get ( const TBaseClass &  base_class) const
inlineinherited

Get addressable class of given base class.

Parameters
base_classbase class

Definition at line 492 of file JRootClass.hh.

493  {
494  return JRootAddressableClass(JRootClass::get(base_class), this->address);
495  }
T get(const JHead &header)
Get object from header.
JRootAddressableClass(T &object)
Constructor.
Definition: JRootClass.hh:437
JRootAddressableClass JROOT::JRootAddressableClass< const char * >::operator[] ( const char *  name) const
inlineinherited

Find addressable base class or data member with given name within current class.

Parameters
namename of base class or data member

Definition at line 503 of file JRootClass.hh.

504  {
505  return this->find(name);
506  }
JRootAddressableClass find(const char *name) const
Find addressable base class or data member with given name within current class.
Definition: JRootClass.hh:470
then echo n User name
Definition: JCookie.sh:45
static bool JROOT::JRootClass::is_class ( const char *const  class_name)
inlinestaticinherited

Check class name against ROOT class names.

Parameters
class_nameclass name
Returns
true if valid class name; else false

Definition at line 47 of file JRootClass.hh.

48  {
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);
54  }
static bool JROOT::JRootClass::is_class ( const TBaseClass &  base_class)
inlinestaticinherited

Check base class against ROOT class names.

Parameters
base_classbase class
Returns
true if valid class name; else false

Definition at line 63 of file JRootClass.hh.

64  {
65  return is_class(base_class.GetName());
66  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:47
static bool JROOT::JRootClass::is_class ( const TDataMember &  data_member)
inlinestaticinherited

Check data member against ROOT class names.

Parameters
data_memberdata member
Returns
true if valid class name; else false

Definition at line 75 of file JRootClass.hh.

76  {
77  return is_class(data_member.GetTypeName());
78  }
static bool is_class(const char *const class_name)
Check class name against ROOT class names.
Definition: JRootClass.hh:47
static bool JROOT::JRootClass::is_STLcontainer ( const TBaseClass &  base_class)
inlinestaticinherited

Check if base class is STL container.

Parameters
base_classbase class
Returns
true if STL congtainer; else false

Definition at line 87 of file JRootClass.hh.

88  {
89  return (const_cast<TBaseClass&>(base_class).IsSTLContainer() != ROOT::kNotSTL);
90  }
static bool JROOT::JRootClass::is_STLcontainer ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is STL container.

Parameters
data_memberdata member
Returns
true if STL congtainer; else false

Definition at line 99 of file JRootClass.hh.

100  {
101  return (const_cast<TDataMember&>(data_member).IsSTLContainer() != ROOT::kNotSTL);
102  }
static bool JROOT::JRootClass::is_STLstring ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is STL string.

Parameters
data_memberdata member
Returns
true if STL string; else false

Definition at line 111 of file JRootClass.hh.

112  {
113  return (strcmp(data_member.GetFullTypeName(), "string") == 0 ||
114  strcmp(data_member.GetFullTypeName(), "const string") == 0);
115  }
static bool JROOT::JRootClass::is_static ( const TDataMember &  data_member)
inlinestaticinherited

Check if data member is static.

Parameters
data_memberdata member
Returns
true if static; else false

Definition at line 124 of file JRootClass.hh.

125  {
126  return (data_member.Property() & kIsStatic);
127  }
TDictionary* JROOT::JRootClass::getDictionary ( ) const
inlineinherited

Get dictionary.

Returns
pointer to dictionary

Definition at line 159 of file JRootClass.hh.

160  {
161  return dictionary;
162  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:310
int JROOT::JRootClass::getOffset ( ) const
inlineinherited

Get offset of this class with respect to parent class.

Returns
offset

Definition at line 170 of file JRootClass.hh.

171  {
172  return offset;
173  }
int offset
offset with respect to data structure [B]
Definition: JRootClass.hh:311
TClass* JROOT::JRootClass::getClass ( ) const
inlineinherited

Get class.

Returns
pointer to class

Definition at line 181 of file JRootClass.hh.

182  {
183  return dynamic_cast<TClass*>(dictionary);
184  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:310
const char* JROOT::JRootClass::getTypename ( ) const
inlineinherited

Get type name.

Returns
type name

Definition at line 192 of file JRootClass.hh.

193  {
194  if (dictionary != NULL)
195  return dictionary->GetName();
196  else
197  return NULL;
198  }
TDictionary * dictionary
pointer to ROOT dictionary
Definition: JRootClass.hh:310
bool JROOT::JRootClass::equals ( const JRootClass object) const
inlineinherited

Test equality of ROOT classes.

Parameters
objectROOT class
Returns
true if both ROOT classes are same type; else false

Definition at line 218 of file JRootClass.hh.

219  {
220  return (this-> getTypename() != NULL &&
221  object.getTypename() != NULL &&
222  strcmp(this->getTypename(), object.getTypename()) == 0);
223  }
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:192
void JROOT::JRootClass::print ( std::ostream &  out) const
inlineinherited

Print ROOT class information.

Parameters
outoutput stream

Definition at line 302 of file JRootClass.hh.

303  {
304  print(out, getTypename());
305  }
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:302
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:192
void JROOT::JRootClass::print ( std::ostream &  out,
const std::string &  prefix 
) const
inlineprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
prefixprefix

Definition at line 342 of file JRootClass.hh.

343  {
344  if (this->is_valid()) {
345 
346  print(out, prefix, this->getTypename());
347 
348  if (this->getClass() != NULL) {
349 
350  if (this->getClass()->GetListOfBases() != NULL) {
351 
352  TIterator* i = this->getClass()->GetListOfBases()->MakeIterator();
353 
354  for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
355  if (!is_STLcontainer(*p))
356  this->get(*p).print(out, prefix + "::" + p->GetName());
357  else
358  print(out, prefix + "::" + p->GetName(), this->get(*p).getTypename());
359  }
360  }
361 
362  if (this->getClass()->GetListOfDataMembers() != NULL) {
363 
364  TIterator* i = this->getClass()->GetListOfDataMembers()->MakeIterator();
365 
366  for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
367  if (!is_STLstring(*p) && !is_STLcontainer(*p))
368  this->get(*p).print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName());
369  else
370  print(out, prefix + (is_static(*p) ? "::" : ".") + p->GetName(), this->get(*p).getTypename());
371  }
372  }
373  }
374  }
375  }
static bool is_STLcontainer(const TBaseClass &base_class)
Check if base class is STL container.
Definition: JRootClass.hh:87
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:302
const char * getTypename() const
Get type name.
Definition: JRootClass.hh:192
static bool is_STLstring(const TDataMember &data_member)
Check if data member is STL string.
Definition: JRootClass.hh:111
bool is_valid() const
Check validity of this class.
Definition: JRootClass.hh:206
TClass * getClass() const
Get class.
Definition: JRootClass.hh:181
static bool is_static(const TDataMember &data_member)
Check if data member is static.
Definition: JRootClass.hh:124
static void JROOT::JRootClass::print ( std::ostream &  out,
const std::string &  name,
const std::string &  type 
)
inlinestaticprotectedinherited

Print ROOT class information.

Parameters
outoutput stream
namename
typetype

Definition at line 385 of file JRootClass.hh.

386  {
387  using namespace std;
388 
389  out << name << " " << '(' << type << ')' << endl;
390  }
then echo n User name
Definition: JCookie.sh:45

Member Data Documentation

TDictionary* JROOT::JRootClass::dictionary
protectedinherited

pointer to ROOT dictionary

Definition at line 310 of file JRootClass.hh.

int JROOT::JRootClass::offset
protectedinherited

offset with respect to data structure [B]

Definition at line 311 of file JRootClass.hh.

pointer_type JROOT::JAddress< const char * >::address
inherited

Definition at line 414 of file JRootClass.hh.


The documentation for this struct was generated from the following file: