Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JTypedef.cc
Go to the documentation of this file.
1
2#include <iostream>
3#include <iomanip>
4
5#include "JLang/JVoid.hh"
6
7#include "Jeep/JParser.hh"
8#include "Jeep/JMessage.hh"
9
10
11namespace {
12
13 using namespace JPP;
14
15 struct __A__ {
16 typedef int data_type;
17 };
18
19 struct __B__ {
20 };
21
22 template<class T, class JType_t = void>
23 struct JTypedef
24 {
25 static const bool has_typedef = false;
26 };
27
28 template<class T>
29 struct JTypedef<T, typename JVoid<typename T::data_type>::type>
30 {
31 static const bool has_typedef = true;
32 };
33
34
35#define PRINT(OUT, T) OUT << #T << ": typedef = " << JTypedef<T>::has_typedef << endl;
36}
37
38
39/**
40 * \file
41 *
42 * Example program to test JLANG::JTypedef class.
43 * \author mdejong
44 */
45int main(int argc, char **argv)
46{
47 using namespace std;
48
49 int debug;
50
51 try {
52
53 JParser<> zap("Example program to test type defs.");
54
55 zap['d'] = make_field(debug) = 3;
56
57 zap(argc, argv);
58 }
59 catch(const exception &error) {
60 FATAL(error.what() << endl);
61 }
62
63
64 PRINT(cout, __A__);
65 PRINT(cout, __B__);
66}
General purpose messaging.
#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
int main(int argc, char **argv)
Definition JTypedef.cc:45
#define PRINT(OUT, T)
Definition JTypedef.cc:35
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< event_type > data_type
Definition JPerth.cc:81
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Definition JFitK40.hh:103
Auxiliary class for void type definition.
Definition JVoid.hh:21