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

Example program to test JPROPERTIES::JProperties class. More...

#include <iostream>
#include <iomanip>
#include <fstream>
#include "Jeep/JProperties.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  JEvent
 Data structure for start_event tag. More...
 

Functions

std::istream & operator>> (std::istream &in, JEvent &event)
 
std::ostream & operator<< (std::ostream &out, const JEvent &event)
 
int main (int argc, char **argv)
 

Detailed Description

Example program to test JPROPERTIES::JProperties class.

Author
mdejong

Definition in file JProperties.cc.

Function Documentation

std::istream& operator>> ( std::istream &  in,
JEvent event 
)
inline

Definition at line 25 of file JProperties.cc.

26 {
27  JEvent::count += 1;
28 
29  return in >> event.number >> event.type;
30 }
static int count
Definition: JProperties.cc:18
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const JEvent event 
)
inline

Definition at line 33 of file JProperties.cc.

34 {
35  return out << event.number << ' ' << event.type;
36 }
int main ( int  argc,
char **  argv 
)

Definition at line 44 of file JProperties.cc.

45 {
46  using namespace std;
47 
48  string inputFile;
49  int debug;
50 
51  try {
52 
53  JParser<> zap;
54 
55  zap['f'] = make_field(inputFile);
56  zap['d'] = make_field(debug) = 0;
57 
58  zap.read(argc, argv);
59  }
60  catch(const exception &error) {
61  FATAL(error.what() << endl);
62  }
63 
64  using namespace JPP;
65 
66  JEvent event;
67 
68  {
69  JProperties zap(JEquationParameters(":", "\n", "", ""), debug);
70 
71  zap["start_event"] = event;
72 
73  ifstream in(inputFile.c_str());
74 
75  zap.read(in);
76 
77  in.close();
78  }
79 
80  cout << "Number of events " << JEvent::count << endl;
81 }
Utility class to parse command line options.
Definition: JParser.hh:1517
Utility class to parse parameter values.
Definition: JProperties.hh:496
static int count
Definition: JProperties.cc:18
Simple data structure to support I/O of equations (see class JLANG::JEquation).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
int read(const int argc, const char *const argv[])
Parse the program&#39;s command line options.
Definition: JParser.hh:1815
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
Data structure for start_event tag.
Definition: JProperties.cc:14
int debug
debug level