Jpp  15.0.1-rc.1-highqe
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
T get(const JHead &header)
Get object from header.
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG