Jpp  18.3.1
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::string
  • size_t
  • std::size_t

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

65  :
67  {
68 #define VALUE_TYPE(__TYPE__) value_type(#__TYPE__, new JObjectStreamer<__TYPE__>())
69 
70  using namespace JPP;
71 
72  this->add(JType<JRemove<JPrimitiveTypes_t, long double>::typelist>());
73 
74  this->add(JType<std::string>());
75 
76  this->insert(VALUE_TYPE(size_t));
77  this->insert(VALUE_TYPE(std::size_t));
78 
79  this->insert(VALUE_TYPE(Char_t));
80  this->insert(VALUE_TYPE(UChar_t));
81  this->insert(VALUE_TYPE(Short_t));
82  this->insert(VALUE_TYPE(UShort_t));
83  this->insert(VALUE_TYPE(Int_t));
84  this->insert(VALUE_TYPE(UInt_t));
85  this->insert(VALUE_TYPE(Long64_t));
86  this->insert(VALUE_TYPE(ULong64_t));
87  this->insert(VALUE_TYPE(Float_t));
88  this->insert(VALUE_TYPE(Double_t));
89 
90 #undef VALUE_TYPE
91  }
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 102 of file JRootDictionary.hh.

103  {
104  const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
105 
106  if (pDictionary != NULL)
107  return pDictionary->GetName();
108  else
109  THROW(JException, "Data type not implemented.");
110  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
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 117 of file JRootDictionary.hh.

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

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

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

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

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