Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JROOT::JRootTypesHandler< JType_t > Class Template Reference

Auxiliary class for handling ROOT types. More...

#include <JRootTypesHandler.hh>

Inheritance diagram for JROOT::JRootTypesHandler< JType_t >:
std::map< std::string, std::shared_ptr< JAbstractType< JType_t > > >

Public Types

typedef std::map< std::string, std::shared_ptr< JAbstractType< JType_t > > > map_type
 

Public Member Functions

 JRootTypesHandler ()
 Default constructor.
 
template<class T >
void operator() (const JType< T > &type)
 Addition of data type.
 
template<class T >
void operator() (const char *const name, const JType< T > &type)
 Addition of data type.
 
void apply (JType_t &object) const
 Apply this handler to given object.
 

Detailed Description

template<class JType_t>
class JROOT::JRootTypesHandler< JType_t >

Auxiliary class for handling ROOT types.

Included types:

  • JPrimitiveTypes_t

Removed types:

  • long double (not supported by ROOT TDictionary)

Added STL types:

  • std::string
  • std::size_t

Added ROOT types:

  • [U]Char_t
  • [U]Short_t
  • [U]Int_t
  • [U]Long_t
  • [U]Long64_t
  • Float_t
  • Double_t
  • LongDouble_t
  • TString

Definition at line 114 of file JRootTypesHandler.hh.

Member Typedef Documentation

◆ map_type

template<class JType_t >
std::map<std::string, std::shared_ptr< JAbstractType<JType_t> > > JROOT::JRootTypesHandler< JType_t >::map_type

Definition at line 119 of file JRootTypesHandler.hh.

Constructor & Destructor Documentation

◆ JRootTypesHandler()

template<class JType_t >
JROOT::JRootTypesHandler< JType_t >::JRootTypesHandler ( )
inline

Default constructor.

Definition at line 124 of file JRootTypesHandler.hh.

125 {
126 using namespace JPP;
127
128 for_each<JTYPELIST<JRemove<JPrimitiveTypes_t, long double>::typelist,
129 std::string,
130 std::size_t>::typelist>(*this);
131
132#define VALUE_TYPE(__TYPE__) typename map_type::value_type(#__TYPE__, new JObjectType<JType_t, __TYPE__>())
133
134 this->insert(VALUE_TYPE(Byte_t));
135 this->insert(VALUE_TYPE(Char_t));
136 this->insert(VALUE_TYPE(UChar_t));
137 this->insert(VALUE_TYPE(Short_t));
138 this->insert(VALUE_TYPE(UShort_t));
139 this->insert(VALUE_TYPE(Int_t));
140 this->insert(VALUE_TYPE(UInt_t));
141 this->insert(VALUE_TYPE(Long_t));
142 this->insert(VALUE_TYPE(ULong_t));
143 this->insert(VALUE_TYPE(Long64_t));
144 this->insert(VALUE_TYPE(ULong64_t));
145 this->insert(VALUE_TYPE(Float_t));
146 this->insert(VALUE_TYPE(Double_t));
147 this->insert(VALUE_TYPE(LongDouble_t));
148 this->insert(VALUE_TYPE(TString));
149
150#undef VALUE_TYPE
151 }
#define VALUE_TYPE(__TYPE__)
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

Member Function Documentation

◆ operator()() [1/2]

template<class JType_t >
template<class T >
void JROOT::JRootTypesHandler< JType_t >::operator() ( const JType< T > & type)
inline

Addition of data type.

This method uses TDictionary> to determine name of given data type.

Parameters
typedata type

Definition at line 162 of file JRootTypesHandler.hh.

163 {
164 const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
165
166 if (pDictionary != NULL)
167 (*this)(pDictionary->GetName(), type);
168 else
169 THROW(JException, "ROOT TDictionary unknown data type " << typeid(T).name());
170 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ operator()() [2/2]

template<class JType_t >
template<class T >
void JROOT::JRootTypesHandler< JType_t >::operator() ( const char *const name,
const JType< T > & type )
inline

Addition of data type.

Parameters
namedata name
typedata type

Definition at line 180 of file JRootTypesHandler.hh.

181 {
182 this->insert(typename map_type::value_type(name, new JObjectType<JType_t, T>()));
183 }

◆ apply()

template<class JType_t >
void JROOT::JRootTypesHandler< JType_t >::apply ( JType_t & object) const
inline

Apply this handler to given object.

Parameters
objectobject

Definition at line 191 of file JRootTypesHandler.hh.

192 {
193 for (typename map_type::const_iterator i = this->begin(); i != this->end(); ++i) {
194 i->second->apply(object, i->first.c_str());
195 }
196 }

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