Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
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
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
Auxiliary class for a fixed group of objects.
Definition: JGroup.hh:31
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG