Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JSingleton.cc File Reference

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

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JSingleton class.

Author
mdejong

Definition in file JSingleton.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 40 of file JSingleton.cc.

41{
42 using namespace std;
43
44 int debug;
45
46 try {
47
48 JParser<> zap("Example program to test singleton.");
49
50 zap['d'] = make_field(debug) = 3;
51
52 zap(argc, argv);
53 }
54 catch(const exception &error) {
55 FATAL(error.what() << endl);
56 }
57
58
59 using namespace JPP;
60
61 cout << "Test of getInstance()" << endl;
62
63 for (int i = 0; i != 5; ++i) {
64
65 cout << "[" << i << "]" << ' ' << flush;
66
67 __A__& a = __A__::getInstance();
68
69 cout << ' ' << a.count;
70
71 cout << endl;
72 }
73
74 cout << "Test of constructor()" << endl;
75
76 for (int i = 0; i != 5; ++i) {
77
78 cout << "[" << i << "]" << ' ' << flush;
79
80 __A__ a;
81
82 cout << ' ' << a.count << ' ';
83 }
84
85 cout << "end of main" << endl;
86}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
const double a
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static data_type & getInstance()
Definition JSingleton.hh:27