Jpp  19.1.0-rc.1
the software that should make you happy
Macros | Functions
JClass.cc File Reference

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

#include <iostream>
#include <iomanip>
#include <vector>
#include "JLang/JClass.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Macros

#define PRINT(OUT, T)   print<T>(OUT, #T)
 Print class parameters. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JClass class.

Author
mdejong

Definition in file JClass.cc.

Macro Definition Documentation

◆ PRINT

#define PRINT (   OUT,
 
)    print<T>(OUT, #T)

Print class parameters.

Parameters
OUToutput stream
Tclass

Definition at line 43 of file JClass.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file JClass.cc.

53 {
54  using namespace std;
55  using namespace JPP;
56 
57  int debug;
58 
59  try {
60 
61  JParser<> zap("Example program to test class inspection.");
62 
63  zap['d'] = make_field(debug) = 3;
64 
65  zap(argc, argv);
66  }
67  catch(const exception &error) {
68  FATAL(error.what() << endl);
69  }
70 
71  if (debug >= debug_t) {
72 
73  cout << setw(36) << left << "name";
74  cout << setw(12) << "primitive";
75  cout << setw(12) << " pointer";
76  cout << setw(12) << "reference";
77  cout << setw(12) << "constant";
78  cout << endl;
79 
80  cout << setfill('.');
81 
82  PRINT(cout, int);
83  PRINT(cout, int&);
84  PRINT(cout, const int*);
85  PRINT(cout, __A__);
86 
89  }
90 
95 
100 
105 
110 
111  ASSERT(!JClass<JClass<int> ::argument_type>::is_reference);
112  ASSERT( JClass<JClass<__A__>::argument_type>::is_reference);
113 
117 
118  ASSERT(is_iterator<vector<__A__>::iterator>::value == true);
122 
123  return 0;
124 }
#define PRINT(OUT, T)
Print class parameters.
Definition: JClass.cc:43
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
@ debug_t
debug
Definition: JMessage.hh:29
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Template for generic class types.
Definition: JClass.hh:80
JArgument< T >::argument_type argument_type
Definition: JClass.hh:82
Data structure to check whether given data type is an iterator.
Definition: JClass.hh:62