Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JClassDef.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <type_traits>
5
6#include "JLang/JType.hh"
7
8#include "JROOT/JClassDef.hh"
9
11#include "JAAnet/JHead.hh"
12
13#include "Jeep/JPrint.hh"
14#include "Jeep/JParser.hh"
15#include "Jeep/JMessage.hh"
16
17namespace {
18
19 using JLANG::JType;
20 using JROOT::JClassDef;
21
22 /**
23 * Print data type.
24 *
25 * \param out output stream
26 * \param type data type
27 * \param option option
28 */
29 template<class T>
30 inline void print(std::ostream& out, const JType<T>& type, const std::true_type opton)
31 {
32 using namespace std;
33
34 out << "ROOT " << T::Class_Name() << endl;
35 }
36
37 /**
38 * Print data type.
39 *
40 * \param out output stream
41 * \param type data type
42 * \param option option
43 */
44 template<class T>
45 inline void print(std::ostream& out, const JType<T>& type, const std::false_type opton)
46 {
47 using namespace std;
48
49 out << "C++ " << typeid(T).name() << endl;
50 }
51
52 /**
53 * Print data type.
54 *
55 * \param out output stream
56 * \param type data type
57 */
58 template<class T>
59 inline void print(std::ostream& out, const JType<T>& type)
60 {
61 print(out, type, std::bool_constant<JClassDef<T>::value>());
62 }
63}
64
65
66/**
67 * \file
68 *
69 * Program to test JROOT::JClassDef.
70 * \author mdejong
71 */
72int main(int argc, char **argv)
73{
74 using namespace std;
75 using namespace JPP;
76
77 int debug;
78
79 try {
80
81 JParser<> zap("Program to test JClassDef.");
82
83 zap['d'] = make_field(debug) = 3;
84
85 zap(argc, argv);
86 }
87 catch(const exception& error) {
88 FATAL(error.what() << endl);
89 }
90
91 print(cout, JType<JHead>());
92 print(cout, JType<double>());
93
94 return 0;
95}
int main(int argc, char **argv)
Definition JClassDef.cc:72
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2140
I/O formatting auxiliaries.
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
Utility class to parse command line options.
Definition JParser.hh:1697
Test ROOT ClassDef.
Definition JClassDef.hh:22
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for a type holder.
Definition JType.hh:19