Jpp  15.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
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
#define FATAL(A)
Definition: JMessage.hh:67
then JCalibrateToT a
Definition: JTuneHV.sh:116