#include <RawFileUtil.h>
|
00277 { 00278 m_record.marker = 0x1234dddd; 00279 m_record.record_size = 10; 00280 // following members are not meaningful @ offline 00281 m_record.date = 0; 00282 m_record.time = 0; 00283 //m_record.events_in_file; //set manually 00284 m_record.data_in_file = 0; 00285 m_record.events_in_run = 0; 00286 m_record.data_in_run = 0; 00287 m_record.status = 1; 00288 m_record.end_marker = 0x1234eeee; 00289 }
|
|
|
|
|
|
00337 { 00338 os << "[RawFile] FileEndRecord:" << std::endl << std::hex 00339 << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl 00340 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl 00341 << "[RawFile] \tdate : 0x" << m_record.date << std::endl 00342 << "[RawFile] \ttime : 0x" << m_record.time << std::endl 00343 << "[RawFile] \tevents_in_file : 0x" << m_record.events_in_file << std::endl 00344 << "[RawFile] \tdata_in_file : 0x" << m_record.data_in_file << std::endl 00345 << "[RawFile] \tevents_in_run : 0x" << m_record.events_in_run << std::endl 00346 << "[RawFile] \tdata_in_run : 0x" << m_record.data_in_run << std::endl 00347 << "[RawFile] \tstatus : 0x" << m_record.status << std::endl 00348 << "[RawFile] \tend_marker : 0x" << m_record.end_marker 00349 << std::dec << std::endl; 00350 }
|
|
00166 { return m_record; }
|
|
00166 { return m_record; }
|
|
00170 { m_record.data_in_file = file_size; }
|
|
00170 { m_record.data_in_file = file_size; }
|
|
00172 { m_record.data_in_run = run_size; }
|
|
00172 { m_record.data_in_run = run_size; }
|
|
00169 { m_record.events_in_file = file_nevt; }
|
|
00169 { m_record.events_in_file = file_nevt; }
|
|
00171 { m_record.events_in_run = run_nevt; }
|
|
00171 { m_record.events_in_run = run_nevt; }
|
|
|
|
|
|
00146 { 00147 // copy file_end_record data that already read by data_separator_record 00148 memcpy((void*)&record.m_record, (const void*)&(sep.getRecord()), sizeof(data_separator_record)); 00149 // read data block 00150 if (is.read((char*)(&record.m_record.events_in_file), ( 00151 sizeof(file_end_record) - sizeof(data_separator_record) 00152 )).fail()) { 00153 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00154 throw BadInputStream("FileEndRecord"); 00155 } 00156 00157 // data validation checks 00158 if (record.m_record.marker != 0x1234dddd) { 00159 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00160 throw WrongMarker(0x1234dddd, record.m_record.marker); 00161 } 00162 if (record.m_record.end_marker != 0x1234eeee) { 00163 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00164 throw WrongMarker(0x1234eeee, record.m_record.end_marker); 00165 } 00166 00167 if (record.m_record.record_size != 10) { 00168 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00169 throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size); 00170 } 00171 00172 return is; 00173 }
|
|
00146 { 00147 // copy file_end_record data that already read by data_separator_record 00148 memcpy((void*)&record.m_record, (const void*)&(sep.getRecord()), sizeof(data_separator_record)); 00149 // read data block 00150 if (is.read((char*)(&record.m_record.events_in_file), ( 00151 sizeof(file_end_record) - sizeof(data_separator_record) 00152 )).fail()) { 00153 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00154 throw BadInputStream("FileEndRecord"); 00155 } 00156 00157 // data validation checks 00158 if (record.m_record.marker != 0x1234dddd) { 00159 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00160 throw WrongMarker(0x1234dddd, record.m_record.marker); 00161 } 00162 if (record.m_record.end_marker != 0x1234eeee) { 00163 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00164 throw WrongMarker(0x1234eeee, record.m_record.end_marker); 00165 } 00166 00167 if (record.m_record.record_size != 10) { 00168 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00169 throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size); 00170 } 00171 00172 return is; 00173 }
|
|
00222 { 00223 // write data block 00224 if (os.write((char*)(&record.m_record), sizeof(file_end_record)).fail()) { 00225 std::cerr << "[RawFile] Error occurred while writing file" << std::endl; 00226 throw FailedToWrite("FileEndRecord"); 00227 } 00228 00229 return os; 00230 }
|
|
00222 { 00223 // write data block 00224 if (os.write((char*)(&record.m_record), sizeof(file_end_record)).fail()) { 00225 std::cerr << "[RawFile] Error occurred while writing file" << std::endl; 00226 throw FailedToWrite("FileEndRecord"); 00227 } 00228 00229 return os; 00230 }
|
|
00121 { 00122 // read data block 00123 if (is.read((char*)(&record.m_record), sizeof(file_end_record)).fail()) { 00124 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00125 throw BadInputStream("FileEndRecord"); 00126 } 00127 00128 // data validation checks 00129 if (record.m_record.marker != 0x1234dddd) { 00130 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00131 throw WrongMarker(0x1234dddd, record.m_record.marker); 00132 } 00133 if (record.m_record.end_marker != 0x1234eeee) { 00134 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00135 throw WrongMarker(0x1234eeee, record.m_record.end_marker); 00136 } 00137 00138 if (record.m_record.record_size != 10) { 00139 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00140 throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size); 00141 } 00142 00143 return is; 00144 }
|
|
00121 { 00122 // read data block 00123 if (is.read((char*)(&record.m_record), sizeof(file_end_record)).fail()) { 00124 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00125 throw BadInputStream("FileEndRecord"); 00126 } 00127 00128 // data validation checks 00129 if (record.m_record.marker != 0x1234dddd) { 00130 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00131 throw WrongMarker(0x1234dddd, record.m_record.marker); 00132 } 00133 if (record.m_record.end_marker != 0x1234eeee) { 00134 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00135 throw WrongMarker(0x1234eeee, record.m_record.end_marker); 00136 } 00137 00138 if (record.m_record.record_size != 10) { 00139 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00140 throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size); 00141 } 00142 00143 return is; 00144 }
|
|
|