#include <RawFileUtil.h>
Public Member Functions | |
void | dump (std::ostream &os=std::cout) const |
void | dump (std::ostream &os=std::cout) const |
FileStartRecord () | |
FileStartRecord () | |
const file_start_record & | getRecord () const |
const file_start_record & | getRecord () const |
void | setFileNumber (uint32_t fn) |
void | setFileNumber (uint32_t fn) |
Private Attributes | |
file_start_record | m_record |
Friends | |
raw_ofstream & | operator<< (raw_ofstream &os, FileStartRecord &record) |
raw_ofstream & | operator<< (raw_ofstream &os, FileStartRecord &record) |
raw_ifstream & | operator>> (raw_ifstream &is, FileStartRecord &record) |
raw_ifstream & | operator>> (raw_ifstream &is, FileStartRecord &record) |
|
00233 { 00234 m_record.marker = 0x1234aaaa; 00235 m_record.record_size = 8; 00236 // following members are not meaningful @ offline 00237 m_record.version = 0; 00238 m_record.file_number = 0; 00239 m_record.date = 0; 00240 m_record.time = 0; 00241 m_record.sizeLimit_dataBlocks = 0; 00242 m_record.sizeLimit_MB = 0; 00243 }
|
|
|
|
|
|
00291 { 00292 os << "[RawFile] FileStartRecord:" << std::endl << std::hex 00293 << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl 00294 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl 00295 << "[RawFile] \tversion : 0x" << m_record.version << std::endl 00296 << "[RawFile] \tfile_number : 0x" << m_record.file_number << std::endl 00297 << "[RawFile] \tdate : 0x" << m_record.date << std::endl 00298 << "[RawFile] \ttime : 0x" << m_record.time << std::endl 00299 << "[RawFile] \tsizeLimit_dataBlocks : 0x" << m_record.sizeLimit_dataBlocks << std::endl 00300 << "[RawFile] \tsizeLimit_MB : 0x" << m_record.sizeLimit_MB 00301 << std::dec << std::endl; 00302 }
|
|
00046 { return m_record; }
|
|
00046 { return m_record; }
|
|
00049 { m_record.file_number = fn; }
|
|
00049 { m_record.file_number = fn; }
|
|
00175 { 00176 // write data block 00177 if (os.write((char*)(&record.m_record), sizeof(file_start_record)).fail()) { 00178 std::cerr << "[RawFile] Error occurred while writing file" << std::endl; 00179 throw FailedToWrite("FileStartRecord"); 00180 } 00181 00182 return os; 00183 }
|
|
00175 { 00176 // write data block 00177 if (os.write((char*)(&record.m_record), sizeof(file_start_record)).fail()) { 00178 std::cerr << "[RawFile] Error occurred while writing file" << std::endl; 00179 throw FailedToWrite("FileStartRecord"); 00180 } 00181 00182 return os; 00183 }
|
|
00007 { 00008 // read data block 00009 if (is.read((char*)(&record.m_record), sizeof(file_start_record)).fail()) { 00010 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00011 throw BadInputStream("FileStartRecord"); 00012 } 00013 00014 // data validation checks 00015 if (record.m_record.marker != 0x1234aaaa) { 00016 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00017 throw WrongMarker(0x1234aaaa, record.m_record.marker); 00018 } 00019 00020 if (record.m_record.record_size != 8) { 00021 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00022 throw UnexpectedRecordSize("FileStartRecord", 8, record.m_record.record_size); 00023 } 00024 00025 return is; 00026 }
|
|
00007 { 00008 // read data block 00009 if (is.read((char*)(&record.m_record), sizeof(file_start_record)).fail()) { 00010 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl; 00011 throw BadInputStream("FileStartRecord"); 00012 } 00013 00014 // data validation checks 00015 if (record.m_record.marker != 0x1234aaaa) { 00016 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl; 00017 throw WrongMarker(0x1234aaaa, record.m_record.marker); 00018 } 00019 00020 if (record.m_record.record_size != 8) { 00021 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl; 00022 throw UnexpectedRecordSize("FileStartRecord", 8, record.m_record.record_size); 00023 } 00024 00025 return is; 00026 }
|
|
|