Jpp  17.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JSinglePointer.cc File Reference

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

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

Author
mdejong

Definition in file JSinglePointer.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 35 of file JSinglePointer.cc.

36 {
37  using namespace std;
38 
39  int debug;
40 
41  try {
42 
43  JParser<> zap("Example program to test single pointer.");
44 
45  zap['d'] = make_field(debug) = 3;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
53 
54  using namespace JPP;
55 
56  const int N = 4;
57 
58  typedef JSinglePointer<__A__> JSinglePointer_t;
59 
60  JSinglePointer_t a;
61 
62  DEBUG("JSinglePointer::create()" << endl);
63 
64  a.create();
65 
67 
68  for (int i = 0; i != N; ++i) {
69 
70  DEBUG("buffer.push_back() " << i << endl);
71 
72  buffer.push_back(a);
73  }
74 
75  for (int i = 0; i != N; ++i) {
76  DEBUG("buffer[" << i << "] is valid? " << buffer[i].is_valid() << endl);
77  }
78 
79  for (int i = 0; i != N; ++i) {
80  ASSERT(i == 0 ? buffer[i].is_valid() : !buffer[i].is_valid());
81  }
82 
83  return 0;
84 }
Utility class to parse command line options.
Definition: JParser.hh:1500
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
bool is_valid(const json &js)
Check validity of JSon data.
int debug
debug level
Definition: JSirene.cc:67
#define FATAL(A)
Definition: JMessage.hh:67
then JCalibrateToT a
Definition: JTuneHV.sh:116
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62