Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPrintRootClass.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
9 
10 #include "JAAnet/JHead.hh"
11 
12 #include "JDAQ/JDAQTimesliceIO.hh"
13 #include "JDAQ/JDAQEventIO.hh"
15 
17 
20 
21 #include "JSupport/JSupport.hh"
22 
23 #include "JROOT/JRootClass.hh"
25 
26 #include "Jeep/JParser.hh"
27 #include "Jeep/JMessage.hh"
28 
29 namespace {
30 
31  using namespace JPP;
32 
33  /**
34  * Auxiliary class for printing class information.
35  */
36  struct JPrinter_t :
37  public JROOTClassSelection
38  {
39  /**
40  * Constructor.
41  *
42  * \param out output stream
43  * \param selection selection
44  */
45  JPrinter_t(std::ostream& out, const JROOTClassSelection& selection) :
46  JROOTClassSelection(selection),
47  out(out)
48  {}
49 
50 
51  /**
52  * Print class infomration.
53  *
54  * \param type data type
55  * \return this printer
56  */
57  template<class T>
58  void operator()(const JType<T>& type) const
59  {
60  using namespace std;
61  using namespace JPP;
62 
63  if (static_cast<const JROOTClassSelection&>(*this)(type)) {
64  JRootClass(type).print(out);
65  }
66  }
67 
68  protected:
69  std::ostream& out;
70  };
71 }
72 
73 
74 /**
75  * \file
76  * Auxiliary program to print ROOT class information.
77  *
78  * The name of the data structure following option -C should be preceded by a '+' or '-'
79  * to add or remove data types in the output, respectively.\n
80  * In this, ROOT wildcards are accepted (e.g. <tt>-C -\\\.\\*</tt> will remove all data types).
81  * \author mdejong
82  */
83 int main(int argc, char **argv)
84 {
85  using namespace std;
86  using namespace JPP;
87 
89 
90  JPrinter_t printer(cout, getROOTClassSelection<typelist>());
91  int debug;
92 
93  try {
94 
95  JParser<> zap("Auxiliary program to print ROOT class information.");
96 
97  zap['C'] = make_field(printer,
98  "Precede name of data structure by a '+' or '-' "
99  "to add or remove data types in the output, respectively."
100  "\nROOT wildcards are accepted.") = JPARSER::initialised();
101  zap['d'] = make_field(debug) = 1;
102 
103  zap(argc, argv);
104  }
105  catch(const exception& error) {
106  FATAL(error.what() << endl);
107  }
108 
109  for_each(printer, JType<typelist>());
110 }
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
void print(std::ostream &out) const
Print ROOT class information.
Definition: JRootClass.hh:309
Auxiliary class for ROOT class selection.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
Auxiliary class for a type holder.
Definition: JType.hh:19
Type list.
Definition: JTypeList.hh:22
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
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.
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:41
int debug
debug level