00001 #include "RawFile/RawFileReader.h" 00002 #include "IRawFile/RawFileExceptions.h" 00003 #include <iostream> 00004 #include <fstream> 00005 00006 using namespace std; 00007 00008 int main(int argc, char* argv[]) 00009 { 00010 if (argc != 3) { 00011 cout << "Usage: " << argv[0] << " file.conf EvtId" << endl; 00012 cout << "***********************************" << endl 00013 << "** NEW: wildcard is supported **" << endl 00014 << "***********************************" << endl; 00015 exit(1); 00016 } 00017 00018 VFileNames_t fnames; 00019 VFileNames_t idxfnames; 00020 00021 string confstr; 00022 ifstream fconf(argv[1]); 00023 00024 while ( !(fconf>>confstr).eof() ) { 00025 if ( confstr == "datafiles" ) { 00026 fconf >> confstr; 00027 fnames.push_back(confstr); 00028 } 00029 else if ( confstr == "idxfiles" ) { 00030 fconf >> confstr; 00031 idxfnames.push_back(confstr); 00032 } 00033 else { 00034 fconf >> confstr; 00035 } 00036 } 00037 00038 RawFileReader *freader; 00039 if ( idxfnames.empty() ) { 00040 freader = new RawFileReader(fnames); 00041 } 00042 else { 00043 freader = new RawFileReader(fnames, idxfnames); 00044 } 00045 00046 uint32_t evtId = atoi( argv[2] ); 00047 00048 try { 00049 const uint32_t* data = freader->findEventById(evtId); 00050 cout << "Size : " << data[1] << " RID: " << data[9+data[5]] << " GID: " << data[8+data[5]] << endl; 00051 } 00052 catch ( RawFileException& e ) { 00053 e.print(); 00054 } 00055 00056 delete freader; 00057 00058 return 0; 00059 }