Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JStorage.cc File Reference

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

#include <iostream>
#include <iomanip>
#include "JLang/JStorage.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::JStorage class.

Author
mdejong

Definition in file JStorage.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 34 of file JStorage.cc.

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
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}
#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
Template storage class.
Definition JStorage.hh:29
virtual void reset() override
Reset pointer.
Definition JStorage.hh:42
void recreate()
Recreate object in memory.
Definition JStorage.hh:57
void create()
Create object in memory.
Definition JStorage.hh:69
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).