BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RunParametersRecord Class Reference

#include <RawFileUtil.h>

Public Member Functions

 RunParametersRecord ()
 
const run_parameters_recordgetRecord () const
 
void dump (std::ostream &os=std::cout) const
 
void setRunNumber (uint32_t runId)
 
 RunParametersRecord ()
 
const run_parameters_recordgetRecord () const
 
void dump (std::ostream &os=std::cout) const
 
void setRunNumber (uint32_t runId)
 

Friends

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

Detailed Description

Constructor & Destructor Documentation

◆ RunParametersRecord() [1/2]

RunParametersRecord::RunParametersRecord ( )

◆ RunParametersRecord() [2/2]

RunParametersRecord::RunParametersRecord ( )

Member Function Documentation

◆ dump() [1/2]

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

Definition at line 314 of file RawFileUtil.cxx.

314 {
315 os << "[RawFile] RunParametersRecord:" << std::endl << std::hex
316 << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl
317 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
318 << "[RawFile] \trun_number : 0x" << m_record.run_number << std::endl
319 << "[RawFile] \tmax_events : 0x" << m_record.max_events << std::endl
320 << "[RawFile] \trec_enable : 0x" << m_record.rec_enable << std::endl
321 << "[RawFile] \ttrigger_type : 0x" << m_record.trigger_type << std::endl
322 << "[RawFile] \tdetector_mask : 0x" << m_record.detector_mask << std::endl
323 << "[RawFile] \tbeam_type : 0x" << m_record.beam_type << std::endl
324 << "[RawFile] \tbeam_energy : 0x" << m_record.beam_energy
325 << std::dec << std::endl;
326}

◆ dump() [2/2]

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

◆ getRecord() [1/2]

const run_parameters_record & RunParametersRecord::getRecord ( ) const
inline

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

106{ return m_record; }

Referenced by raw_ifstream::runNo().

◆ getRecord() [2/2]

const run_parameters_record & RunParametersRecord::getRecord ( ) const
inline

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

106{ return m_record; }

◆ setRunNumber() [1/2]

void RunParametersRecord::setRunNumber ( uint32_t  runId)
inline

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

109{ m_record.run_number = runId; }

◆ setRunNumber() [2/2]

void RunParametersRecord::setRunNumber ( uint32_t  runId)
inline

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

109{ m_record.run_number = runId; }

Friends And Related Function Documentation

◆ operator<< [1/2]

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

Definition at line 202 of file RawFileUtil.cxx.

202 {
203 // write data block
204 if (os.write((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
205 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
206 throw FailedToWrite("RunParametersRecord");
207 }
208
209 return os;
210}

◆ operator<< [2/2]

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

Definition at line 202 of file RawFileUtil.cxx.

202 {
203 // write data block
204 if (os.write((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
205 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
206 throw FailedToWrite("RunParametersRecord");
207 }
208
209 return os;
210}

◆ operator>> [1/2]

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

Definition at line 75 of file RawFileUtil.cxx.

75 {
76 // read data block
77 if (is.read((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
78 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
79 throw BadInputStream("RunParametersRecord");
80 }
81
82 // data validation checks
83 if (record.m_record.marker != 0x1234bbbb) {
84 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
85 throw WrongMarker(0x1234bbbb, record.m_record.marker);
86 }
87
88 if (record.m_record.record_size != 9) {
89 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
90 throw UnexpectedRecordSize("RunParametersRecord", 9, record.m_record.record_size);
91 }
92
93 return is;
94}

◆ operator>> [2/2]

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

Definition at line 75 of file RawFileUtil.cxx.

75 {
76 // read data block
77 if (is.read((char*)(&record.m_record), sizeof(run_parameters_record)).fail()) {
78 //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
79 throw BadInputStream("RunParametersRecord");
80 }
81
82 // data validation checks
83 if (record.m_record.marker != 0x1234bbbb) {
84 //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
85 throw WrongMarker(0x1234bbbb, record.m_record.marker);
86 }
87
88 if (record.m_record.record_size != 9) {
89 //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
90 throw UnexpectedRecordSize("RunParametersRecord", 9, record.m_record.record_size);
91 }
92
93 return is;
94}

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