Jpp  19.1.0-rc.1
the software that should make you happy
Namespaces | Functions | Variables
JGroup.cc File Reference

Example program to test JLANG::JGroup class. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JLang/JGroup.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Namespaces

 JLANG
 Auxiliary classes and methods for language specific functionality.
 

Functions

int main (int argc, char **argv)
 

Variables

static const JGroup< double > & JLANG::getElement = JGroup<double>::getInstance()
 

Detailed Description

Example program to test JLANG::JGroup class.

Author
mdejong

Definition in file JGroup.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file JGroup.cc.

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 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
static const JGroup< double > & getElement
Definition: JGroup.cc:21
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Auxiliary class for a fixed group of objects.
Definition: JGroup.hh:31