Jpp  test_elongated_shower_pde
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JStorage.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "JLang/JStorage.hh"
6 
7 #include "Jeep/JParser.hh"
8 #include "Jeep/JMessage.hh"
9 
10 
11 namespace {
12 
13  struct __A__
14  {
15  __A__()
16  {
17  std::cout << "__A__()" << std::endl;
18  }
19 
20  ~__A__()
21  {
22  std::cout << "~__A__()" << std::endl;
23  }
24  };
25 }
26 
27 
28 /**
29  * \file
30  *
31  * Example program to test JLANG::JStorage class.
32  * \author mdejong
33  */
34 int main(int argc, char **argv)
35 {
36  using namespace std;
37 
38  int debug;
39 
40  try {
41 
42  JParser<> zap("Example program to test creation and deletion of objects.");
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 
53  using namespace JPP;
54 
55  {
56  cout << "JStorage<double>" << endl;
57 
58  JStorage<double> storage;
59 
60  storage.create();
61 
62  *storage = 123.456;
63 
64  cout << *storage << endl;
65 
66  storage.reset();
67  }
68 
69  {
70  cout << "JStorage<__A__>" << endl;
71 
72  JStorage<__A__> storage;
73 
74  for (int i = 0; i != 4; ++i) {
75 
76  cout << i << ' ' << "recreate()" << endl;
77 
78  storage.recreate();
79  }
80 
81  cout << "reset()" << endl;
82 
83  storage.reset();
84  }
85 
86  {
87  cout << "JStorage<__A__, JNewCArray>" << endl;
88 
89  JStorage<__A__, JNewCArray> storage;
90 
91  cout << "reset()" << endl;
92 
93  storage.reset();
94 
95  const int N = 2;
96 
97  cout << "create(" << N << ")" << endl;
98 
99  storage.create(N);
100 
101  cout << "reset()" << endl;
102 
103  storage.reset();
104  }
105 }
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 make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:68
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.