#include #include #include #include "Jeep/JProperties.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * Data structure for start_event tag. */ struct JEvent { int number; int type; static int count; // global event counter }; int JEvent::count = 0; // initialisation of global event counter inline std::istream& operator>>(std::istream& in, JEvent& event) { JEvent::count += 1; return in >> event.number >> event.type; } inline std::ostream& operator<<(std::ostream& out, const JEvent& event) { return out << event.number << ' ' << event.type; } /** * \file * Example program to test JPROPERTIES::JProperties class. * \author mdejong */ int main(int argc, char **argv) { using namespace std; string inputFile; int debug; try { JParser<> zap; zap['f'] = make_field(inputFile); zap['d'] = make_field(debug) = 0; zap.read(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } using namespace JPP; JEvent event; { JProperties zap(JEquationParameters(":", "\n", "", ""), debug); zap["start_event"] = event; ifstream in(inputFile.c_str()); zap.read(in); in.close(); } cout << "Number of events " << JEvent::count << endl; }