Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JAbstractClass.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
15 struct __C__ {
16 virtual ~__C__() {}
17 virtual void c() = 0;
18 };
19
20
21 /**
22 * Print class parameters.
23 *
24 * \param out output stream
25 * \param name name of class
26 */
27 template<class T>
28 inline void print(std::ostream& out, const char* name)
29 {
30 using namespace std;
31 using namespace JPP;
32
33 out << setw(36) << left << name;
34 out << setw(4) << '.' << setw(8) << left << JAbstractClass<T>::is_abstract;
35 out << endl;
36 }
37}
38
39
40/**
41 * Print class parameters.
42 *
43 * \param OUT output stream
44 * \param T class
45 */
46#define PRINT(OUT, T) print<T>(OUT, #T)
47
48
49/**
50 * \file
51 *
52 * Example program to test JLANG::JAbstractClass 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(36) << left << "name";
77 cout << setw(12) << "abstract";
78 cout << endl;
79
80 cout << setfill('.');
81
82 PRINT(cout, int);
83 PRINT(cout, __A__);
84 PRINT(cout, __C__);
85 }
86
90}
int main(int argc, char **argv)
#define PRINT(OUT, T)
Print class parameters.
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.
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template class test for abstractness.