BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
FileStartRecord Class Reference

#include <RawFileUtil.h>

Public Member Functions

 FileStartRecord ()
 
const file_start_recordgetRecord () const
 
void dump (std::ostream &os=std::cout) const
 
void setFileNumber (uint32_t fn)
 
 FileStartRecord ()
 
const file_start_recordgetRecord () const
 
void dump (std::ostream &os=std::cout) const
 
void setFileNumber (uint32_t fn)
 

Friends

raw_ifstreamoperator>> (raw_ifstream &is, FileStartRecord &record)
 
raw_ofstreamoperator<< (raw_ofstream &os, FileStartRecord &record)
 
raw_ifstreamoperator>> (raw_ifstream &is, FileStartRecord &record)
 
raw_ofstreamoperator<< (raw_ofstream &os, FileStartRecord &record)
 

Detailed Description

Constructor & Destructor Documentation

◆ FileStartRecord() [1/2]

FileStartRecord::FileStartRecord ( )

Definition at line 232 of file RawFileUtil.cxx.

◆ FileStartRecord() [2/2]

FileStartRecord::FileStartRecord ( )

Member Function Documentation

◆ dump() [1/2]

void FileStartRecord::dump ( std::ostream &  os = std::cout) const

Definition at line 291 of file RawFileUtil.cxx.

291 {
292 os << "[RawFile] FileStartRecord:" << std::endl << std::hex
293 << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl
294 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
295 << "[RawFile] \tversion : 0x" << m_record.version << std::endl
296 << "[RawFile] \tfile_number : 0x" << m_record.file_number << std::endl
297 << "[RawFile] \tdate : 0x" << m_record.date << std::endl
298 << "[RawFile] \ttime : 0x" << m_record.time << std::endl
299 << "[RawFile] \tsizeLimit_dataBlocks : 0x" << m_record.sizeLimit_dataBlocks << std::endl
300 << "[RawFile] \tsizeLimit_MB : 0x" << m_record.sizeLimit_MB
301 << std::dec << std::endl;
302}

◆ dump() [2/2]

void FileStartRecord::dump ( std::ostream &  os = std::cout) const

◆ getRecord() [1/2]

const file_start_record & FileStartRecord::getRecord ( ) const
inline

Definition at line 46 of file Event/RawFile/RawFile-00-00-10/RawFile/RawFileUtil.h.

46{ return m_record; }

◆ getRecord() [2/2]

const file_start_record & FileStartRecord::getRecord ( ) const
inline

Definition at line 46 of file InstallArea/include/RawFile/RawFile/RawFileUtil.h.

46{ return m_record; }

◆ setFileNumber() [1/2]

void FileStartRecord::setFileNumber ( uint32_t  fn)
inline

Definition at line 49 of file Event/RawFile/RawFile-00-00-10/RawFile/RawFileUtil.h.

49{ m_record.file_number = fn; }

◆ setFileNumber() [2/2]

void FileStartRecord::setFileNumber ( uint32_t  fn)
inline

Definition at line 49 of file InstallArea/include/RawFile/RawFile/RawFileUtil.h.

49{ m_record.file_number = fn; }

Friends And Related Function Documentation

◆ operator<< [1/2]

raw_ofstream & operator<< ( raw_ofstream os,
FileStartRecord record 
)
friend

Definition at line 175 of file RawFileUtil.cxx.

175 {
176 // write data block
177 if (os.write((char*)(&record.m_record), sizeof(file_start_record)).fail()) {
178 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
179 throw FailedToWrite("FileStartRecord");
180 }
181
182 return os;
183}

◆ operator<< [2/2]

raw_ofstream & operator<< ( raw_ofstream os,
FileStartRecord record 
)
friend

Definition at line 175 of file RawFileUtil.cxx.

175 {
176 // write data block
177 if (os.write((char*)(&record.m_record), sizeof(file_start_record)).fail()) {
178 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
179 throw FailedToWrite("FileStartRecord");
180 }
181
182 return os;
183}

◆ operator>> [1/2]

raw_ifstream & operator>> ( raw_ifstream is,
FileStartRecord record 
)
friend

Definition at line 7 of file RawFileUtil.cxx.

7 {
8 // read data block
9 if (is.read((char*)(&record.m_record), sizeof(file_start_record)).fail()) {
10 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
11 throw BadInputStream("FileStartRecord");
12 }
13
14 // data validation checks
15 if (record.m_record.marker != 0x1234aaaa) {
16 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
17 throw WrongMarker(0x1234aaaa, record.m_record.marker);
18 }
19
20 if (record.m_record.record_size != 8) {
21 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
22 throw UnexpectedRecordSize("FileStartRecord", 8, record.m_record.record_size);
23 }
24
25 return is;
26}

◆ operator>> [2/2]

raw_ifstream & operator>> ( raw_ifstream is,
FileStartRecord record 
)
friend

Definition at line 7 of file RawFileUtil.cxx.

7 {
8 // read data block
9 if (is.read((char*)(&record.m_record), sizeof(file_start_record)).fail()) {
10 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
11 throw BadInputStream("FileStartRecord");
12 }
13
14 // data validation checks
15 if (record.m_record.marker != 0x1234aaaa) {
16 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
17 throw WrongMarker(0x1234aaaa, record.m_record.marker);
18 }
19
20 if (record.m_record.record_size != 8) {
21 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
22 throw UnexpectedRecordSize("FileStartRecord", 8, record.m_record.record_size);
23 }
24
25 return is;
26}

The documentation for this class was generated from the following files: