Jpp  17.0.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 
8 
9 #include "JAAnet/JHead.hh"
10 
11 #include "JDAQ/JDAQTimesliceIO.hh"
12 #include "JDAQ/JDAQEventIO.hh"
14 
16 
19 
20 #include "JSupport/JSupport.hh"
21 
22 #include "JROOT/JRootClass.hh"
24 
25 #include "Jeep/JParser.hh"
26 #include "Jeep/JMessage.hh"
27 
28 namespace {
29 
30  using namespace JPP;
31 
32  /**
33  * Auxiliary class for printing class information.
34  */
35  struct JPrinter_t :
36  public JROOTClassSelection
37  {
38  /**
39  * Constructor.
40  *
41  * \param out output stream
42  * \param selection selection
43  */
44  JPrinter_t(std::ostream& out, const JROOTClassSelection& selection) :
45  JROOTClassSelection(selection),
46  out(out)
47  {}
48 
49 
50  /**
51  * Print class infomration.
52  *
53  * \param type data type
54  * \return this printer
55  */
56  template<class T>
57  void operator()(const JType<T>& type) const
58  {
59  using namespace std;
60  using namespace JPP;
61 
62  if (static_cast<const JROOTClassSelection&>(*this)(type)) {
63  JRootClass(type).print(out);
64  }
65  }
66 
67  protected:
68  std::ostream& out;
69  };
70 }
71 
72 
73 /**
74  * \file
75  * Auxiliary program to print ROOT class information.
76  *
77  * The name of the data structure following option -C should be preceded by a '+' or '-'
78  * to add or remove data types in the output, respectively.\n
79  * In this, ROOT wildcards are accepted (e.g. <tt>-C -\\\.\\*</tt> will remove all data types).
80  * \author mdejong
81  */
82 int main(int argc, char **argv)
83 {
84  using namespace std;
85  using namespace JPP;
86 
88 
89  JPrinter_t printer(cout, getROOTClassSelection<typelist>());
90  int debug;
91 
92  try {
93 
94  JParser<> zap("Auxiliary program to print ROOT class information.");
95 
96  zap['C'] = make_field(printer,
97  "Precede name of data structure by a '+' or '-' "
98  "to add or remove data types in the output, respectively."
99  "\nROOT wildcards are accepted.") = JPARSER::initialised();
100  zap['d'] = make_field(debug) = 1;
101 
102  zap(argc, argv);
103  }
104  catch(const exception& error) {
105  FATAL(error.what() << endl);
106  }
107 
108  for_each(printer, JType<typelist>());
109 }
Utility class to parse command line options.
Definition: JParser.hh:1500
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:305
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:66
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:1961
int debug
debug level
Definition: JSirene.cc:66
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:40