Jpp
examples
JLang
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
11
namespace
{
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
*/
45
int
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
}
JMessage.hh
main
int main(int argc, char **argv)
Definition:
JTypedef.cc:45
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JVoid.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
debug
int debug
debug level
Definition:
JSirene.cc:59
PRINT
#define PRINT(OUT, T)
Definition:
JTypedef.cc:35
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
std
Definition:
jaanetDictionary.h:36
JLANG::JVoid
Auxiliary class for void type definition.
Definition:
JVoid.hh:20
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
Generated by
1.8.16