Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JBaseClass.cc File Reference

Example program to test JLANG::JBaseClass class. More...

#include <iostream>
#include <iomanip>
#include "JLang/JBaseClass.hh"
#include "JLang/JTypeList.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JBaseClass class.

Author
mdejong

Definition in file JBaseClass.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 38 of file JBaseClass.cc.

39{
40 using namespace std;
41
42 int debug;
43
44 try {
45
46 JParser<> zap("Example program to test selection of base class.");
47
48 zap['d'] = make_field(debug) = 3;
49
50 zap(argc, argv);
51 }
52 catch(const exception &error) {
53 FATAL(error.what() << endl);
54 }
55
56 using namespace JPP;
57
58 typedef JTYPELIST<__A__,
59 __B__,
60 __C__,
61 __D__>::typelist typelistABCD;
62
63 typedef JTYPELIST<__B__,
64 __A__,
65 __C__,
66 __D__>::typelist typelistBACD;
67
68 typedef JTYPELIST<__B__,
69 __C__,
70 __A__,
71 __D__>::typelist typelistBCAD;
72
73 typedef JTYPELIST<__B__,
74 __C__,
75 __D__,
76 __A__>::typelist typelistBCDA;
77
78 DEBUG("A,B,C,D <- A? " << (JBaseType_t<__A__, typelistABCD>::is_base) << endl);
79 DEBUG("A,B,C,D <- B? " << (JBaseType_t<__B__, typelistABCD>::is_base) << endl);
80
81 DEBUG("A,B,C,D -> " << JBaseClass<typelistABCD>::data_type::get() << endl);
82 DEBUG("B,A,C,D -> " << JBaseClass<typelistBACD>::data_type::get() << endl);
83 DEBUG("B,C,A,D -> " << JBaseClass<typelistBCAD>::data_type::get() << endl);
84 DEBUG("B,C,D,A -> " << JBaseClass<typelistBCDA>::data_type::get() << endl);
85 DEBUG("B -> " << JBaseClass< JTypeList<__B__> >::data_type::get() << endl);
86
91 ASSERT(JBaseClass< JTypeList<__B__> >::data_type::get() == __B__::get());
92 /*
93 typedef JTYPELIST<__B__,
94 __C__,
95 __D__>::typelist typelist;
96
97 typedef JBaseClass<typelist>::data_type data_type; // will give compiler error (as should be)
98 */
99
100 return 0;
101}
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
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 definition of class to look for base class in type list.
Template class to test for polymorphism.
Definition JBaseClass.hh:22
Auxiliary class for recursive type list generation.
Definition JTypeList.hh:351
Type list.
Definition JTypeList.hh:23