/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/eformat/eformat-00-00-04/test/check-old.cxx

Go to the documentation of this file.
00001 //Dear emacs, this is -*- c++ -*-
00002 
00016 #include <fstream>
00017 #include <iostream>
00018 #include <cstdlib>
00019 
00020 #include "eformat/eformat.h"
00021 #include "eformat/old/eformat.h"
00022 
00026 const size_t MAX_EVENT_SIZE = 2500000;
00027 
00031 int main (int argc, char** argv)
00032 {
00033   using namespace eformat;
00034   
00035   if ( argc != 2 ) {
00036     std::cerr << "usage: " << argv[0] << " <file>" << std::endl;
00037     std::exit(1);
00038   }
00039 
00040   //open normally a file
00041   std::fstream in(argv[1], std::ios::in|std::ios::binary);
00042   if (!in) {
00043     std::cerr << "File `" << argv[1] << "' does not exist?!" << std::endl;
00044     std::exit(1);
00045   }
00046   uint32_t* event = new uint32_t[MAX_EVENT_SIZE];
00047   
00048   while (true) {
00049     
00050     if (!(next_fragment(in, event, MAX_EVENT_SIZE*4))) break;
00051     
00052     try {
00053       old::FullEventFragment fe(event);
00054       //old::ROSFragment fe(event);
00055       fe.check_tree();
00056 
00057       //if check is ok, print the lvl1 identifier
00058       std::cout << "Event " << fe.lvl1_id() << " is Ok." << std::endl;
00059     }
00060     catch (eformat::Issue& ex) {
00061       std::cerr << std::endl
00062                 << "Uncaught eformat issue: " << ex.what() << std::endl;
00063       std::cout << "Trying to continue..." << std::endl;
00064       continue;
00065     }
00066     catch (ers::Issue& ex) {
00067       std::cerr << std::endl
00068                 << "Uncaught ERS issue: " << ex.what() << std::endl;
00069       delete[] event;
00070       std::exit(1);
00071     }
00072     catch (std::exception& ex) {
00073       std::cerr << std::endl
00074                 << "Uncaught std exception: " << ex.what() << std::endl;
00075       delete[] event;
00076       std::exit(1);
00077     }
00078     catch (...) {
00079       std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
00080       delete[] event;
00081       std::exit(1);
00082     }
00083 
00084   }
00085 
00086   delete[] event;
00087   return 0;
00088 }

Generated on Tue Nov 29 22:58:26 2016 for BOSS_7.0.2 by  doxygen 1.4.7