Jpp
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
JSUPPORT::JAutoTreeScanner
Auxiliary class to select JTreeScanner based on ROOT class name.
Definition: JAutoTreeScanner.hh:34
JLANG::JSinglePointer
The template JSinglePointer class can be used to hold a pointer to an object.
Definition: JSinglePointer.hh:24
JLANG::JType
Auxiliary class for a type holder.
Definition: JType.hh:19
JSUPPORT::JAutoTreeScanner::JElement_t
Auxiliary class for element insertion.
Definition: JAutoTreeScanner.hh:81
JSinglePointer.hh
JLANG::JNullType
Auxiliary class for no type definition.
Definition: JNullType.hh:19
JROOTClassSelector.hh
JTOOLS::JAutoMap
Forward declaration of class JAutoMap for specialisation of class JAutomate.
Definition: JAutoMap.hh:29
JSUPPORT::JAutoTreeScanner::reverse_iterator
map_type::reverse_iterator reverse_iterator
Definition: JAutoTreeScanner.hh:43
JTreeScanner.hh
JSUPPORT::JAutoTreeScanner::JAutoTreeScanner
JAutoTreeScanner(JType< T > type)
Constructor.
Definition: JAutoTreeScanner.hh:61
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JSUPPORT::JAutoTreeScanner::insert
void insert()
Insert list of data types.
Definition: JAutoTreeScanner.hh:71
JROOT::JROOTClassSelector
Auxiliary class to select ROOT class based on class name.
Definition: JROOTClassSelector.hh:32
JSUPPORT::JAutoTreeScanner::const_iterator
map_type::const_iterator const_iterator
Definition: JAutoTreeScanner.hh:40
JSUPPORT::JTreeScanner
Template definition for direct access of elements in ROOT TChain.
Definition: JTreeScanner.hh:91
JLANG::JAssertConversion
Auxialiary class to assert type conversion.
Definition: JConversion.hh:66
JSUPPORT::JAutoTreeScanner::JElement_t::JElement_t
JElement_t(JType< T > type)
Constructor.
Definition: JAutoTreeScanner.hh:90
JSUPPORT::JAutoTreeScanner::value_type
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::value_type value_type
Definition: JAutoTreeScanner.hh:38
JSUPPORT::JAutoTreeScanner::JAutoTreeScanner
JAutoTreeScanner()
Default constructor.
Definition: JAutoTreeScanner.hh:51
JSUPPORT
Support classes and methods for experiment specific I/O.
Definition: JDataWriter.cc:38
JNullType.hh
JSUPPORT::JAutoTreeScanner::const_reverse_iterator
map_type::const_reverse_iterator const_reverse_iterator
Definition: JAutoTreeScanner.hh:42
JTOOLS::JAutomate
Auxiliary class for automatic element creation.
Definition: JAutoMap.hh:40
JType.hh
JSUPPORT::JAutoTreeScanner::map_type
JAutoMap< std::string, JSinglePointer< JTreeScannerInterface< JBase_t, JEvaluator_t > > >::map_type map_type
Definition: JAutoTreeScanner.hh:37
JSUPPORT::JAutoTreeScanner::iterator
map_type::iterator iterator
Definition: JAutoTreeScanner.hh:41
JAutoMap.hh