Jpp
17.2.0
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JLang
JGroup.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <iomanip>
5
6
#include "
JLang/JGroup.hh
"
7
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
namespace
{
12
13
using
JLANG::JGroup
;
14
15
template
<>
16
const
double
JGroup<double>::group[] = {
17
0.0,
18
1.0,
19
2.0,
20
3.0
21
};
22
23
static
const
JGroup<double>& getElement =
JGroup<double>::getInstance
();
24
}
25
26
27
/**
28
* \file
29
*
30
* Example program to test JLANG::JGroup class.
31
* \author mdejong
32
*/
33
int
main
(
int
argc,
char
**argv)
34
{
35
using namespace
std;
36
using namespace
JPP;
37
38
int
debug
;
39
40
try
{
41
42
JParser<>
zap(
"Example program to test groups."
);
43
44
zap[
'd'
] =
make_field
(
debug
) = 3;
45
46
zap(argc, argv);
47
}
48
catch
(
const
exception &error) {
49
FATAL
(error.what() << endl);
50
}
51
52
DEBUG
(
"Size of group "
<< JGroup<double>::size << endl);
53
54
const
int
N
= 4;
55
56
for
(
int
i = 0; i !=
N
; ++i) {
57
DEBUG
(i <<
' '
<< getElement(i) << endl);
58
}
59
60
ASSERT
(JGroup<double>::size ==
N
,
"Test size of group."
);
61
62
for
(
int
i = 0; i !=
N
; ++i) {
63
ASSERT
(getElement(i) == (
double
) i,
"Test element access."
);
64
}
65
66
return
0;
67
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1517
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
N
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Definition:
JShowerPostfit.sh:95
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition:
JMessage.hh:90
JLANG::getInstance
T & getInstance(const T &object)
Get static instance from temporary object.
Definition:
JObject.hh:75
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1993
JLANG::JGroup
Auxiliary class for a fixed group of objects.
Definition:
JGroup.hh:31
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JGroup.hh
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-Detectors.sh:95
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5