Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPrintTreeParameters.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
7 
8 #include "JAAnet/JSupport.hh"
9 #include "JDAQ/JSupport.hh"
10 #include "JSupport/JSupport.hh"
11 
12 #include "JLang/JBool.hh"
13 #include "JLang/JType.hh"
14 
15 #include "Jeep/JParser.hh"
16 #include "Jeep/JMessage.hh"
17 
18 
19 namespace {
20 
21  using namespace JPP;
22 
23  /**
24  * Printer for TTree parameters.
25  */
26  struct JPrinter {
27  /**
28  * Print TTree parameters of given data type.
29  *
30  * \param type type
31  */
32  template<class T>
33  void operator()(JType<T> type)
34  {
36  }
37 
38  /**
39  * Print TTree parameters of given data type according option.
40  *
41  * \param type type
42  * \param option option
43  */
44  template<class T>
45  static void print(JType<T> type, JBool<true> option)
46  {
47  using namespace std;
48  using namespace JPP;
49 
50  cout << getTreeParameters<T>() << endl;
51  };
52 
53  /**
54  * Print TTree parameters of given data type according option.
55  *
56  * \param type type
57  * \param option option
58  */
59  template<class T>
60  static void print(JType<T> type, JBool<false> option)
61  {}
62  };
63 }
64 
65 
66 /**
67  * \file
68  *
69  * Auxiliary program to print ROOT TTree parameters.
70  * \author mdejong
71  */
72 int main(int argc, char **argv)
73 {
74  using namespace std;
75  using namespace JPP;
76  using namespace KM3NETDAQ;
77 
78  int debug;
79 
80  try {
81 
82  JParser<> zap("Auxiliary program to print ROOT TTree parameters.");
83 
84  zap['d'] = make_field(debug) = 1;
85 
86  zap(argc, argv);
87  }
88  catch(const exception &error) {
89  FATAL(error.what() << endl);
90  }
91 
92  JPrinter printer;
93 
94  for_each(printer, JType<JAllTypes_t>());
95 }
Utility class to parse command line options.
Definition: JParser.hh:1517
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
Auxiliary class to temporarily replace std::ostream.
Test availability of TTree parameters for given class.
Auxiliary class for a type holder.
Definition: JType.hh:19
ROOT TTree parameter settings.
Auxiliary template class for type bool.
Definition: JBool.hh:20
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
print
Definition: JConvertDusj.sh:44
General purpose messaging.
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:415
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
ROOT TTree parameter settings.
int debug
debug level