Jpp  debug
the software that should make you happy
Functions
JTemplateIO.cc File Reference

Example program to test JLANG::JTemplateReader and JLANG::JTemplateWriter classes. More...

#include <iostream>
#include <iomanip>
#include <sstream>
#include "JLang/JEquals.hh"
#include "JLang/JMultiEquals.hh"
#include "JLang/JTemplateWriter.hh"
#include "JLang/JTemplateReader.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::JTemplateReader and JLANG::JTemplateWriter classes.

Author
mdejong

Definition in file JTemplateIO.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 140 of file JTemplateIO.cc.

141 {
142  using namespace std;
143 
144  int debug;
145 
146  try {
147 
148  JParser<> zap("Example program to test template I/O.");
149 
150  zap['d'] = make_field(debug) = 3;
151 
152  zap(argc, argv);
153  }
154  catch(const exception &error) {
155  FATAL(error.what() << endl);
156  }
157 
158  using namespace JPP;
159 
160  const __D__ a(1,2,3);
161 
162  {
163  stringstream io;
164 
165  io << a;
166 
167  __D__ b;
168 
169  io >> b;
170 
171  DEBUG("a = " << a << endl);
172  DEBUG("b = " << b << endl);
173 
174  ASSERT(a == b);
175  }
176  {
178 
179  stringstream io;
180 
181  io << a;
182 
183  for (int value, i = 0; io >> value; ++i) {
184 
185  const int c = io.get();
186 
187  ASSERT((i < 2 && c == (int) '|') ||
188  (i == 2 && c == EOF));
189  }
190  }
191 
192  return 0;
193 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
const double a
Definition: JQuadrature.cc:42
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Template definition of auxiliary base class for composite data types which derive from one or more ba...