Jpp  15.0.0
the software that should make you happy
 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

Default implementation of ROOT based dictionary for ASCII I/O. More...

#include <JRootDictionary.hh>

Inheritance diagram for JROOT::JRootDictionary:
JROOT::JRootDictionary_t JLANG::JSingleton< T > std::map< std::string, JLANG::JSharedPointer< JROOT::JAbstractStreamer > >

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

Default implementation of ROOT based dictionary for ASCII I/O.

Definition at line 39 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 STL type definitions:

  • std::size_t
  • std::string

Added ROOT type definitions:

  • [U]Char_t
  • [U]Short_t
  • [U]Int_t
  • [U]Long64_t
  • [U]Float_t
  • [U]Double_t

Definition at line 64 of file JRootDictionary.hh.

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

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 101 of file JRootDictionary.hh.

102  {
103  const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
104 
105  if (pDictionary != NULL)
106  return pDictionary->GetName();
107  else
108  THROW(JException, "Data type not implemented.");
109  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
void JROOT::JRootDictionary::add ( )
inline

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

Definition at line 116 of file JRootDictionary.hh.

117  {
118  add(JType<T>());
119  }
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 129 of file JRootDictionary.hh.

130  {
131  this->insert(value_type(getTypename<T>(), new JObjectStreamer<T>()));
132 
133  try {
134  this->insert(value_type(getTypename< std::vector<T> >(), new JObjectStreamer< std::vector<T> >()));
135  }
136  catch(const JException& error) {};
137  }
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 146 of file JRootDictionary.hh.

147  {
149 
150  this->insert(value_type(getTypename<data_type>(), new JObjectStreamer<data_type>()));
151  }
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 160 of file JRootDictionary.hh.

161  {
162  add(JType<JHead_t>());
163  add(JType<JTail_t>());
164  }
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 172 of file JRootDictionary.hh.

173  {}
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: