Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JRootDictionary.hh
Go to the documentation of this file.
1#ifndef __JROOT__JROOTDICTIONARY__
2#define __JROOT__JROOTDICTIONARY__
3
4#include <string>
5#include <vector>
6#include <typeinfo>
7
8#include "TDictionary.h"
9
10#include "JLang/JType.hh"
11#include "JLang/JSingleton.hh"
12#include "JLang/JException.hh"
13
17
18
19/**
20 * \author mdejong
21 */
22
23namespace JROOT {}
24namespace JPP { using namespace JROOT; }
25
26namespace JROOT {
27
28 using JLANG::JType;
31
32 /**
33 * Default implementation of ROOT based dictionary for ASCII I/O.
34 */
36 public JRootDictionary_t,
37 public JSingleton<JRootDictionary>
38 {
39 public:
40 /**
41 * Default constructor.
42 */
45 {
46 handler(*this);
47 }
48
49
50 /**
51 * Addition of class and container classes.
52 */
53 template<class T>
54 void add()
55 {
56 using namespace JPP;
57
58 for_each<typename JTYPELIST< T, std::vector<T> >::typelist>(*this);
59 }
60
61
62 /**
63 * Addition of class.
64 *
65 * \param type data type
66 */
67 template<class T>
68 void operator()(const JType<T>& type)
69 {
70 const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
71
72 if (pDictionary != NULL)
73 (*this)(pDictionary->GetName(), type);
74 else
75 THROW(JException, "ROOT TDictionary unknown data type.");
76 }
77
78
79 /**
80 * Addition of class.
81 *
82 * \param name data name
83 * \param type data type
84 */
85 template<class T>
86 void operator()(const char* const name, const JType<T>& type)
87 {
88 this->insert(value_type(name, new JObjectStreamer<T>()));
89 }
90 };
91}
92
93#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
ASCII I/O of objects with ROOT dictionary.
General exception.
Definition JException.hh:24
JObjectStreamer class.
Default implementation of ROOT based dictionary for ASCII I/O.
void operator()(const JType< T > &type)
Addition of class.
void add()
Addition of class and container classes.
void operator()(const char *const name, const JType< T > &type)
Addition of class.
JRootDictionary()
Default constructor.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
void handler(JType_t &object)
Apply ROOT types handler to given object.
Simple singleton class.
Definition JSingleton.hh:18
Auxiliary class for a type holder.
Definition JType.hh:19
Type definition of ROOT based dictionary for ASCII I/O.