Jpp  18.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
11 #include "JSupport/JTreeScanner.hh"
12 
13 
14 /**
15  * \author mdejong
16  */
17 
18 namespace JSUPPORT {}
19 namespace JPP { using namespace JSUPPORT; }
20 
21 namespace 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  */
52  {}
53 
54 
55  /**
56  * Constructor.
57  *
58  * \param type data type
59  */
60  template<class T>
62  {
63  this->insert<T>();
64  }
65 
66 
67  /**
68  * Insert list of data types.
69  */
70  template<class T>
71  void insert()
72  {
73  this->insert<T>(JTOOLS::JAutomate<JElement_t>());
74  }
75 
76 
77  protected:
78  /**
79  * Auxiliary class for element insertion.
80  */
81  struct JElement_t :
82  public value_type
83  {
84  /**
85  * Constructor.
86  *
87  * \param type data type
88  */
89  template<class T>
91  value_type(JROOTClassSelector(JType<T>()), new JTreeScanner<JAssertConversion<T, JBase_t>, JEvaluator_t>())
92  {}
93  };
94  };
95 }
96 
97 #endif
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::map_type map_type
map_type::reverse_iterator reverse_iterator
map_type::iterator iterator
Auxiliary class to select ROOT class based on class name.
Auxialiary class to assert type conversion.
Definition: JConversion.hh:66
JElement_t(JType< T > type)
Constructor.
Auxiliary class for automatic element creation.
Definition: JAutoMap.hh:46
void insert()
Insert list of data types.
Auxiliary class for a type holder.
Definition: JType.hh:19
Template definition for direct access of elements in ROOT TChain.
JAutoTreeScanner(JType< T > type)
Constructor.
The template JSinglePointer class can be used to hold a pointer to an object.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Auxiliary class for no type definition.
Definition: JNullType.hh:19
map_type::const_iterator const_iterator
Auxiliary class to select JTreeScanner based on ROOT class name.
JAutoTreeScanner()
Default constructor.
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::value_type value_type
Auxiliary class for element insertion.
Wrapper class around std::map for automatic insertion of elements based on data types.
Definition: JAutoMap.hh:31
map_type::const_reverse_iterator const_reverse_iterator