#include #include #include #include #include "TFile.h" #include "JSupport/JMeta.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test JSUPPORT::JMeta class. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string outputFile; vector buffer; int debug; try { JParser<> zap("Example program to test meta."); zap['o'] = make_field(outputFile) = "meta.root"; zap['x'] = make_field(buffer); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } argv[0] = (char*) "test"; // rename const JMeta meta(argc, argv); DEBUG(meta << endl); DEBUG(meta.toString() << endl); ASSERT(JMeta::valueOf(meta.toString()) == meta); { TFile* file = TFile::Open(outputFile.c_str(), "recreate"); putObject(file, meta); file->Write(); file->Close(); } { TFile* file = TFile::Open(outputFile.c_str(), "exists"); ASSERT(file != NULL); JMeta* p = NULL; const int cycle = 1; getObject(file, MAKE_CSTRING(META_NAME << ';' << cycle), p); ASSERT(p != NULL); DEBUG(*p); ASSERT(meta == *p); file->Close(); } return 0; }