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

◆ data_type

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

Definition at line 20 of file JSingleton.hh.

Constructor & Destructor Documentation

◆ JRootDictionary()

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 
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  }
#define VALUE_TYPE(__TYPE__)
void add()
Add ASCII I/O for given (list of) class(es) to dictionary.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Removal of data type from type list.
Definition: JTypeList.hh:114
Auxiliary class for a type holder.
Definition: JType.hh:19
Type definition of ROOT based dictionary for ASCII I/O.

Member Function Documentation

◆ getTypename()

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
General exception.
Definition: JException.hh:24

◆ add() [1/5]

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  }

◆ add() [2/5]

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.

◆ add() [3/5]

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  }

◆ add() [4/5]

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  }

◆ add() [5/5]

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

◆ getInstance()

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: