Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
Jeep
JProperties.cc
Go to the documentation of this file.
1
2
#include <iostream>
3
#include <iomanip>
4
#include <fstream>
5
6
#include "
Jeep/JProperties.hh
"
7
#include "
Jeep/JParser.hh
"
8
#include "
Jeep/JMessage.hh
"
9
10
11
/**
12
* Data structure for start_event tag.
13
*/
14
struct
JEvent
{
15
int
number
;
16
int
type
;
17
18
static
int
count
;
// global event counter
19
};
20
21
22
int
JEvent::count
= 0;
// initialisation of global event counter
23
24
25
inline
std::istream&
operator>>
(std::istream&
in
,
JEvent
& event)
26
{
27
JEvent::count
+= 1;
28
29
return
in >>
event
.number >>
event
.type;
30
}
31
32
33
inline
std::ostream&
operator<<
(std::ostream& out,
const
JEvent
& event)
34
{
35
return
out <<
event
.number <<
' '
<<
event
.type;
36
}
37
38
39
/**
40
* \file
41
* Example program to test JPROPERTIES::JProperties class.
42
* \author mdejong
43
*/
44
int
main
(
int
argc,
char
**argv)
45
{
46
using namespace
std;
47
48
string
inputFile;
49
int
debug
;
50
51
try
{
52
53
JParser<>
zap;
54
55
zap[
'f'
] =
make_field
(inputFile);
56
zap[
'd'
] =
make_field
(
debug
) = 0;
57
58
zap.
read
(argc, argv);
59
}
60
catch
(
const
exception &error) {
61
FATAL
(error.what() << endl);
62
}
63
64
using namespace
JPP;
65
66
JEvent
event;
67
68
{
69
JProperties
zap(
JEquationParameters
(
":"
,
"\n"
,
""
,
""
),
debug
);
70
71
zap[
"start_event"
] = event;
72
73
ifstream
in
(inputFile.c_str());
74
75
zap.
read
(
in
);
76
77
in
.close();
78
}
79
80
cout <<
"Number of events "
<<
JEvent::count
<< endl;
81
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JEEP::JProperties::read
bool read(const JEquation &equation)
Read equation.
Definition:
JProperties.hh:677
in
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition:
JSirene.sh:45
JEEP::JProperties
Utility class to parse parameter values.
Definition:
JProperties.hh:496
JEvent::count
static int count
Definition:
JProperties.cc:18
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition:
JEquationParameters.hh:20
JEvent::type
int type
Definition:
JProperties.cc:16
JProperties.hh
Utility class to parse parameter values.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
JEvent::number
int number
Definition:
JProperties.cc:15
debug
int debug
debug level
Definition:
JSirene.cc:61
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
operator>>
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Definition:
JHead.hh:1278
JPARSER::JParser::read
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Definition:
JParser.hh:1791
JParser.hh
Utility class to parse command line options.
operator<<
std::ostream & operator<<(std::ostream &stream, const CLBCommonHeader &header)
Definition:
clb_common_header.hh:72
JEvent
Data structure for start_event tag.
Definition:
JProperties.cc:14
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5