Jpp
18.3.0-rc.1
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
JLANG {
12
13
template
<>
14
const
double
JGroup<double>::group
[] = {
15
0.0,
16
1.0,
17
2.0,
18
3.0
19
};
20
21
static
const
JGroup<double>
&
getElement
=
JGroup<double>::getInstance
();
22
}
23
24
25
/**
26
* \file
27
*
28
* Example program to test JLANG::JGroup class.
29
* \author mdejong
30
*/
31
int
main
(
int
argc,
char
**argv)
32
{
33
using namespace
std;
34
using namespace
JPP;
35
36
int
debug
;
37
38
try
{
39
40
JParser<>
zap(
"Example program to test groups."
);
41
42
zap[
'd'
] =
make_field
(
debug
) = 3;
43
44
zap(argc, argv);
45
}
46
catch
(
const
exception &error) {
47
FATAL
(error.what() << endl);
48
}
49
50
DEBUG
(
"Size of group "
<< JGroup<double>::size << endl);
51
52
const
int
N
= 4;
53
54
for
(
int
i
= 0;
i
!=
N
; ++
i
) {
55
DEBUG
(
i
<<
' '
<<
getElement
(
i
) << endl);
56
}
57
58
ASSERT
(JGroup<double>::size ==
N
,
"Test size of group."
);
59
60
for
(
int
i
= 0;
i
!=
N
; ++
i
) {
61
ASSERT
(
getElement
(
i
) == (
double
)
i
,
"Test element access."
);
62
}
63
64
return
0;
65
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JLANG::getElement
static const JGroup< double > & getElement
Definition:
JGroup.cc:21
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition:
JMessage.hh:90
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JLANG::JGroup::getInstance
static const JGroup & getInstance()
Get unique instance.
Definition:
JGroup.hh:51
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
N
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition:
JMuonPostfit.sh:40
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5