Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JNet
JSubscription.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
#include <sstream>
5
6
#include "
JNet/JControlHost.hh
"
7
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
12
/**
13
* \file
14
*
15
* Example program to test JNET::JSubscription.
16
* \author mdejong
17
*/
18
int
main
(
int
argc,
char
* argv[])
19
{
20
using namespace
std;
21
using namespace
JPP;
22
23
int
debug
;
24
25
try
{
26
27
JParser<>
zap(
"Example program to test JNET::JSubscription."
);
28
29
zap[
'd'
] =
make_field
(
debug
) = 3;
30
31
zap(argc, argv);
32
}
33
catch
(
const
exception &error) {
34
FATAL
(error.what() << endl);
35
}
36
37
38
JSubscriptionList subscription;
39
40
const
JTag
a
(
"A"
);
41
const
JTag b(
"B"
);
42
const
JTag c(
"C"
);
43
44
const
JTag tags[] = {
a
, b, c };
45
const
size_t
N
=
sizeof
(tags)/
sizeof
(tags[0]);
46
47
subscription = JSubscriptionAny(a) + JSubscriptionAny(b) + JSubscriptionAny(c);
48
49
ASSERT
(subscription->size() ==
N
);
50
51
52
for
(
size_t
i = 0; i !=
N
; ++i) {
53
subscription += JSubscriptionAny(tags[i]);
54
}
55
56
ASSERT
(subscription->size() ==
N
);
57
58
59
for
(
size_t
i = 0; i !=
N
; ++i) {
60
subscription += JSubscriptionAll(tags[i]);
61
}
62
63
ASSERT
(subscription->size() ==
N
);
64
65
for
(JSubscriptionList::const_iterator i = subscription->begin(); i != subscription->end(); ++i) {
66
ASSERT
(i->getSubscription() ==
SUBSCRIBE_ALL
);
67
}
68
69
70
for
(
size_t
i = 0; i !=
N
; ++i) {
71
subscription += JSubscriptionAny(tags[i]);
72
}
73
74
ASSERT
(subscription->size() ==
N
);
75
76
for
(JSubscriptionList::const_iterator i = subscription->begin(); i != subscription->end(); ++i) {
77
ASSERT
(i->getSubscription() ==
SUBSCRIBE_ALL
);
78
}
79
80
return
0;
81
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
JControlHost.hh
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JNET::SUBSCRIBE_ALL
Definition:
JControlHost.hh:41
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:1961
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
a
then $JPP_DIR software JCalibrate JCalibrateToT a
Definition:
JTuneHV.sh:108
JParser.hh
Utility class to parse command line options.
N
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition:
JMuonPostfit.sh:37
Generated by
1.8.5