Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JAutoTreeScanner.hh
Go to the documentation of this file.
1#ifndef __JSUPPORT__JAUTOTREESCANNER__
2#define __JSUPPORT__JAUTOTREESCANNER__
3
4#include <string>
5
6#include "JLang/JType.hh"
7#include "JLang/JNullType.hh"
10#include "JTools/JAutoMap.hh"
12
13
14/**
15 * \author mdejong
16 */
17
18namespace JSUPPORT {}
19namespace JPP { using namespace JSUPPORT; }
20
21namespace JSUPPORT {
22
23 using JLANG::JType;
24 using JLANG::JNullType;
27 using JTOOLS::JAutoMap;
28
29
30 /**
31 * Auxiliary class to select JTreeScanner based on ROOT class name.
32 */
33 template<class JBase_t, class JEvaluator_t = JNullType>
35 public JAutoMap<std::string, JSinglePointer< JTreeScannerInterface<JBase_t, JEvaluator_t> > >
36 {
39
40 typedef typename map_type::const_iterator const_iterator;
41 typedef typename map_type::iterator iterator;
42 typedef typename map_type::const_reverse_iterator const_reverse_iterator;
43 typedef typename map_type::reverse_iterator reverse_iterator;
44
46
47
48 /**
49 * Default constructor.
50 */
53
54
55 /**
56 * Constructor.
57 *
58 * \param type data type
59 * \param option include namespace
60 */
61 template<class T>
62 JAutoTreeScanner(JType<T> type, const bool option = false) :
64 {
65 this->template insert<T>();
66 }
67
68
69 /**
70 * Get option to include name space.
71 *
72 * \return option
73 */
74 bool getOption() const
75 {
76 return option;
77 }
78
79
80 /**
81 * Insert list of data types.
82 */
83 template<class T>
84 void insert()
85 {
86 using namespace JPP;
87
88 if (option)
90 else
92 }
93
94
95 private:
96 /**
97 * Auxiliary class for element insertion.
98 */
99 template<bool option>
100 struct JElement_t :
101 public value_type
102 {
103 /**
104 * Constructor.
105 *
106 * \param type data type
107 */
108 template<class T>
110 value_type(JROOTClassSelector(type, option), new JTreeScanner<JAssertConversion<T, JBase_t>, JEvaluator_t>())
111 {}
112 };
113
114 bool option; //!< include namespace
115 };
116}
117
118#endif
Auxialiary class to assert type conversion.
The template JSinglePointer class can be used to hold a pointer to an object.
Template definition for direct access of elements in ROOT TChain.
Wrapper class around std::map for automatic insertion of elements based on data types.
Definition JAutoMap.hh:93
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
Auxiliary class for no type definition.
Definition JNullType.hh:19
Auxiliary class for a type holder.
Definition JType.hh:19
Auxiliary class to select ROOT class based on class name.
Auxiliary class for element insertion.
JElement_t(JType< T > type)
Constructor.
Auxiliary class to select JTreeScanner based on ROOT class name.
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::value_type value_type
bool option
include namespace
map_type::const_reverse_iterator const_reverse_iterator
JAutoTreeScanner(JType< T > type, const bool option=false)
Constructor.
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::map_type map_type
map_type::const_iterator const_iterator
bool getOption() const
Get option to include name space.
JAutoTreeScanner()
Default constructor.
void insert()
Insert list of data types.
map_type::reverse_iterator reverse_iterator
Auxiliary class for automatic element creation.
Definition JAutoMap.hh:46