#include <fstream>
#include <iostream>
#include <cstdlib>
#include "eformat/eformat.h"
#include "eformat/old/eformat.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
Variables | |
const size_t | MAX_EVENT_SIZE = 2500000 |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Reads a file and check its validity (for the time being)
Definition at line 31 of file check-old.cxx.
References MAX_EVENT_SIZE, eformat::next_fragment(), and ers::Issue::what().
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 }
const size_t MAX_EVENT_SIZE = 2500000 |