Jpp  16.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
then JCalibrateToT a
Definition: JTuneHV.sh:116
Utility class to parse command line options.
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'