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

ROOT dictionary. More...

#include <JRootDictionary.hh>

Inheritance diagram for JROOT::JRootDictionary:
std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > JLANG::JSingleton< T > JAANET::JAAnetDictionary

Public Types

typedef T data_type
 

Public Member Functions

 JRootDictionary ()
 Default constructor. More...
 
template<class T >
void add ()
 Add ASCII I/O for given (list of) class(es) to dictionary. More...
 

Static Public Member Functions

template<class T >
static const char * getTypename ()
 Get typename for given template class. More...
 
static data_typegetInstance ()
 Get unique instance of template class. More...
 

Protected Member Functions

template<class T >
void add (const JType< T > &type)
 Addition of class. More...
 
template<class JElement_t , class JAllocator_t >
void add (const JType< std::vector< JElement_t, JAllocator_t > > &type)
 Addition of std::vector. More...
 
template<class JHead_t , class JTail_t >
void add (const JType< JTypeList< JHead_t, JTail_t > > &typelist)
 Recursive addition of classes. More...
 
void add (const JType< JNullType > &type)
 Template specialisation to terminate addition of classes. More...
 

Detailed Description

ROOT dictionary.

This class can be used for ASCII I/O of ROOT objects.

Definition at line 44 of file JRootDictionary.hh.

Member Typedef Documentation

template<class T>
typedef T JLANG::JSingleton< T >::data_type
inherited

Definition at line 20 of file JSingleton.hh.

Constructor & Destructor Documentation

JROOT::JRootDictionary::JRootDictionary ( )
inline

Default constructor.

This constructor builds a default dictionary which includes all primitive data types and std::vector thereof.

Removed types:

  • long double (not supported by ROOT TDictionary)

Added ROOT type definitions:

  • std::string
  • [U]Char_t
  • [U]Short_t
  • [U]Int_t
  • [U]Long64_t
  • [U]Float_t
  • [U]Double_t

Definition at line 66 of file JRootDictionary.hh.

66  :
68  {
69 #define VALUE_TYPE(__TYPE__) value_type(#__TYPE__, new JObjectStreamer<__TYPE__>())
70 
71  using namespace JPP;
72 
73  this->add(JType<JRemove<JPrimitiveTypes_t, long double>::typelist>());
74  this->add(JType<std::string>());
75 
76  this->insert(VALUE_TYPE(Char_t));
77  this->insert(VALUE_TYPE(UChar_t));
78  this->insert(VALUE_TYPE(Short_t));
79  this->insert(VALUE_TYPE(UShort_t));
80  this->insert(VALUE_TYPE(Int_t));
81  this->insert(VALUE_TYPE(UInt_t));
82  this->insert(VALUE_TYPE(Long64_t));
83  this->insert(VALUE_TYPE(ULong64_t));
84  this->insert(VALUE_TYPE(Float_t));
85  this->insert(VALUE_TYPE(Double_t));
86 
87 #undef VALUE_TYPE
88  }
void add()
Add ASCII I/O for given (list of) class(es) to dictionary.
#define VALUE_TYPE(__TYPE__)
std::map< std::string, JSharedPointer< JAbstractStreamer > > JRootDictionary_t
Type definition of ROOT dictionary.

Member Function Documentation

template<class T >
static const char* JROOT::JRootDictionary::getTypename ( )
inlinestatic

Get typename for given template class.

This method uses the TDictionary class to get the name of the given class.

Returns
type name

Definition at line 99 of file JRootDictionary.hh.

100  {
101  const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
102 
103  if (pDictionary != NULL)
104  return pDictionary->GetName();
105  else
106  throw JException("Error at getTypename(): data type not implemented.");
107  }
template<class T >
void JROOT::JRootDictionary::add ( )
inline

Add ASCII I/O for given (list of) class(es) to dictionary.

Definition at line 114 of file JRootDictionary.hh.

115  {
116  add(JType<T>());
117  }
void add()
Add ASCII I/O for given (list of) class(es) to dictionary.
template<class T >
void JROOT::JRootDictionary::add ( const JType< T > &  type)
inlineprotected

Addition of class.

Parameters
typedata type

Definition at line 127 of file JRootDictionary.hh.

128  {
129  this->insert(value_type(getTypename<T>(), new JObjectStreamer<T>()));
130 
131  try {
132  this->insert(value_type(getTypename< std::vector<T> >(), new JObjectStreamer< std::vector<T> >()));
133  }
134  catch(const JException& error) {};
135  }
JObjectStreamer class.
static const char * getTypename()
Get typename for given template class.
template<class JElement_t , class JAllocator_t >
void JROOT::JRootDictionary::add ( const JType< std::vector< JElement_t, JAllocator_t > > &  type)
inlineprotected

Addition of std::vector.

Parameters
typedata type

Definition at line 144 of file JRootDictionary.hh.

145  {
147 
148  this->insert(value_type(getTypename<data_type>(), new JObjectStreamer<data_type>()));
149  }
JObjectStreamer class.
template<class JHead_t , class JTail_t >
void JROOT::JRootDictionary::add ( const JType< JTypeList< JHead_t, JTail_t > > &  typelist)
inlineprotected

Recursive addition of classes.

Parameters
typelisttype list

Definition at line 158 of file JRootDictionary.hh.

159  {
160  add(JType<JHead_t>());
161  add(JType<JTail_t>());
162  }
void add()
Add ASCII I/O for given (list of) class(es) to dictionary.
void JROOT::JRootDictionary::add ( const JType< JNullType > &  type)
inlineprotected

Template specialisation to terminate addition of classes.

Parameters
typenull type

Definition at line 170 of file JRootDictionary.hh.

171  {}
template<class T>
static data_type& JLANG::JSingleton< T >::getInstance ( )
inlinestaticinherited

Get unique instance of template class.

Returns
object

Definition at line 27 of file JSingleton.hh.

28  {
29  static data_type value;
30 
31  return value;
32  }

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