Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
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

◆ operator>>()

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

◆ operator<<()

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}

◆ main()

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}
#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 parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Utility class to parse command line options.
Definition JParser.hh:1698
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Definition JParser.hh:1992
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Data structure for start_event tag.