Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JConstructor.cc
Go to the documentation of this file.
1
2#include <iostream>
3#include <iomanip>
4
6
7#include "Jeep/JParser.hh"
8#include "Jeep/JMessage.hh"
9
10
11namespace {
12
13 struct __A__ {};
14 struct __B__ {};
15 struct __C__ {
16 __C__(const __A__&) {}
17 };
18
19 /**
20 * Print class parameters.
21 *
22 * \param out output stream
23 * \param uname name of class
24 * \param vname name of class
25 */
26 template<class U, class V>
27 inline void print(std::ostream& out, const char* uname, const char* vname)
28 {
29 using namespace std;
30 using namespace JPP;
31
32 out << setw(16) << left << string(string(uname) + string("(") + string(vname) + string(")"));
33 out << setw(8) << " " << JConstructor<U, V>::has_constructor;
34 out << endl;
35 }
36}
37
38
39/**
40 * Print class parameters.
41 *
42 * \param OUT output stream
43 * \param U class
44 * \param V class
45 */
46#define PRINT(OUT, U, V) print<U,V>(OUT, #U, #V)
47
48
49/**
50 * \file
51 *
52 * Example program to test JLANG::JConstructor class.
53 * \author mdejong
54 */
55int main(int argc, char **argv)
56{
57 using namespace std;
58 using namespace JPP;
59
60 int debug;
61
62 try {
63
64 JParser<> zap("Example program to test class inspection.");
65
66 zap['d'] = make_field(debug) = 3;
67
68 zap(argc, argv);
69 }
70 catch(const exception &error) {
71 FATAL(error.what() << endl);
72 }
73
74 if (debug >= debug_t) {
75
76 cout << setw(16) << left << "name";
77 cout << " has constructor ";
78 cout << endl;
79
80 PRINT(cout, __A__, __A__);
81 PRINT(cout, __C__, __A__);
82 PRINT(cout, __C__, __B__);
83 }
84
88}
#define PRINT(OUT, U, V)
Print class parameters.
int main(int argc, char **argv)
General purpose messaging.
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
Template class test for availability of a suitable constructor JType_t(const JArgument_t).
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).