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

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

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

Author
mdejong

Definition in file JMultiPointer.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 81 of file JMultiPointer.cc.

82{
83 using namespace std;
84
85 int debug;
86
87 try {
88
89 JParser<> zap("Example program to test multi pointer.");
90
91 zap['d'] = make_field(debug) = 3;
92
93 zap(argc, argv);
94 }
95 catch(const exception &error) {
96 FATAL(error.what() << endl);
97 }
98
99
100 using namespace JPP;
101
102 {
103 JMultiPointer< JTypeList<int> > ps(new int(-123));
104
105 print<int>(cout, ps);
106
107 delete ps.get<int>();
108 }
109
110
111 {
112 typedef
113 JTypeList<const char,
114 JTypeList<int,
115 JTypeList<double> > > typelist;
116
118
119 ps.reset("aap");
120 ps.reset(new int(1));
121 ps.reset(new double(123.456));
122
123 *ps.get<int>() += 10;
124
125 print<int> (cout, ps);
126 print<const char>(cout, ps);
127 print<double> (cout, ps);
128
129 delete ps.get<int> ();
130 delete ps.get<double>();
131 }
132}
#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
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
General purpose class for multiple pointers.
T * get() const
Get single pointer.
void reset(const JMultiPointer< JClass_t > &pointer)
Reset multi-pointer.
Type list.
Definition JTypeList.hh:23