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

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

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

Author
mdejong

Definition in file JReference.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 18 of file JReference.cc.

19{
20 using namespace std;
21
22 int debug;
23
24 try {
25
26 JParser<> zap("Example program to test referencing of objects.");
27
28 zap['d'] = make_field(debug) = 3;
29
30 zap(argc, argv);
31 }
32 catch(const exception &error) {
33 FATAL(error.what() << endl);
34 }
35
36
37 using namespace JPP;
38
39 cout << "JPointer <int> p(new int());" << endl;
40
41 JPointer <int> p(new int());
42
43 cout << "JReference<int* const> o(p);" << endl;
44
46
47 cout << "*p = 123;" << endl;
48
49 *p = 123;
50
51 cout << setw(3) << left << "*o" << " == " << setw(3) << left << "*p" << "?" << endl;
52 cout << setw(3) << right << *o << " == " << setw(3) << right << *p << endl;
53}
#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
The template JReference class can be used to reference an object.
Definition JReference.hh:21
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).