Jpp  18.2.1-ARCA-DF-PATCH
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 JLANG {
12 
13  template<>
14  const double JGroup<double>::group[] = {
15  0.0,
16  1.0,
17  2.0,
18  3.0
19  };
20 
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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
static const JGroup< double > & getElement
Definition: JGroup.cc:21
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
static const JGroup & getInstance()
Get unique instance.
Definition: JGroup.hh:51
Auxiliary class for a fixed group of objects.
Definition: JGroup.hh:31
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
Utility class to parse command line options.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62