#include #include #include #include "JROOT/JASCIIFileStreamer.hh" #include "JABC.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Program to test JROOT::JASCIIFileReader and JROOT::JASCIIFileWriter classes. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string inputFile; string outputFile; int debug; try { JParser<> zap("Program to test ASCII I/O based on ROOT dictionary."); zap['f'] = make_field(inputFile) = ""; zap['o'] = make_field(outputFile) = ""; zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } vector buffer; if (inputFile != "") { JASCIIFileReader in(inputFile.c_str()); JABC object; while (in >> object) { DEBUG(object.a << ' ' << object.b << ' ' << object.c << endl); buffer.push_back(object); } in.close(); } if (outputFile != "") { JASCIIFileWriter out(outputFile.c_str()); for (const auto& object : buffer) { out << object << endl; } out.close(); } return 0; }