BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DataSeparatorRecord Class Reference

#include <RawFileUtil.h>

Public Member Functions

 DataSeparatorRecord ()
const data_separator_recordgetRecord () const
void dump (std::ostream &os=std::cout) const
void setDataBlockNumber (uint32_t dn)
void setDataBlockSize (uint32_t ds)
 DataSeparatorRecord ()
const data_separator_recordgetRecord () const
void dump (std::ostream &os=std::cout) const
void setDataBlockNumber (uint32_t dn)
void setDataBlockSize (uint32_t ds)
 DataSeparatorRecord ()
const data_separator_recordgetRecord () const
void dump (std::ostream &os=std::cout) const
void setDataBlockNumber (uint32_t dn)
void setDataBlockSize (uint32_t ds)

Friends

raw_ifstreamoperator>> (raw_ifstream &is, DataSeparatorRecord &record)
std::ofstream & operator<< (std::ofstream &os, DataSeparatorRecord &record)
raw_ifstreamoperator>> (raw_ifstream &is, DataSeparatorRecord &record)
std::ofstream & operator<< (std::ofstream &os, DataSeparatorRecord &record)
raw_ifstreamoperator>> (raw_ifstream &is, DataSeparatorRecord &record)
std::ofstream & operator<< (std::ofstream &os, DataSeparatorRecord &record)

Detailed Description

Definition at line 125 of file Event/RawFile/include/RawFile/RawFileUtil.h.

Constructor & Destructor Documentation

◆ DataSeparatorRecord() [1/3]

DataSeparatorRecord::DataSeparatorRecord ( )

Definition at line 294 of file RawFileUtil.cxx.

294 {
295 m_record.marker = 0x1234cccc;
296 m_record.record_size = 4;
297 // m_record.data_block_number; //set manually
298 // m_record.data_block_size; //set manually
299}

Referenced by operator<<, and operator>>.

◆ DataSeparatorRecord() [2/3]

DataSeparatorRecord::DataSeparatorRecord ( )

◆ DataSeparatorRecord() [3/3]

DataSeparatorRecord::DataSeparatorRecord ( )

Member Function Documentation

◆ dump() [1/3]

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

Definition at line 351 of file RawFileUtil.cxx.

351 {
352 os << "[RawFile] DataSeparatorRecord:" << std::endl
353 << std::hex << "[RawFile] \tmarker : 0x" << m_record.marker << std::endl
354 << "[RawFile] \trecord_size : 0x" << m_record.record_size << std::endl
355 << "[RawFile] \tdata_block_number : 0x" << m_record.data_block_number << std::endl
356 << "[RawFile] \tdata_block_size : 0x" << m_record.data_block_size << std::dec
357 << std::endl;
358}

◆ dump() [2/3]

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

◆ dump() [3/3]

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

◆ getRecord() [1/3]

const data_separator_record & DataSeparatorRecord::getRecord ( ) const
inline

Definition at line 132 of file Event/RawFile/include/RawFile/RawFileUtil.h.

132{ return m_record; }

Referenced by FileEndRecord::makeEndRecord.

◆ getRecord() [2/3]

const data_separator_record & DataSeparatorRecord::getRecord ( ) const
inline

Definition at line 132 of file InstallArea/x86_64-el9-gcc13-dbg/include/RawFile/RawFileUtil.h.

132{ return m_record; }

◆ getRecord() [3/3]

const data_separator_record & DataSeparatorRecord::getRecord ( ) const
inline

Definition at line 132 of file InstallArea/x86_64-el9-gcc13-opt/include/RawFile/RawFileUtil.h.

132{ return m_record; }

◆ setDataBlockNumber() [1/3]

void DataSeparatorRecord::setDataBlockNumber ( uint32_t dn)
inline

Definition at line 135 of file Event/RawFile/include/RawFile/RawFileUtil.h.

135{ m_record.data_block_number = dn; }

◆ setDataBlockNumber() [2/3]

void DataSeparatorRecord::setDataBlockNumber ( uint32_t dn)
inline

Definition at line 135 of file InstallArea/x86_64-el9-gcc13-dbg/include/RawFile/RawFileUtil.h.

135{ m_record.data_block_number = dn; }

◆ setDataBlockNumber() [3/3]

void DataSeparatorRecord::setDataBlockNumber ( uint32_t dn)
inline

Definition at line 135 of file InstallArea/x86_64-el9-gcc13-opt/include/RawFile/RawFileUtil.h.

135{ m_record.data_block_number = dn; }

◆ setDataBlockSize() [1/3]

void DataSeparatorRecord::setDataBlockSize ( uint32_t ds)
inline

Definition at line 136 of file Event/RawFile/include/RawFile/RawFileUtil.h.

136{ m_record.data_block_size = ds; }

◆ setDataBlockSize() [2/3]

void DataSeparatorRecord::setDataBlockSize ( uint32_t ds)
inline

Definition at line 136 of file InstallArea/x86_64-el9-gcc13-dbg/include/RawFile/RawFileUtil.h.

136{ m_record.data_block_size = ds; }

◆ setDataBlockSize() [3/3]

void DataSeparatorRecord::setDataBlockSize ( uint32_t ds)
inline

Definition at line 136 of file InstallArea/x86_64-el9-gcc13-opt/include/RawFile/RawFileUtil.h.

136{ m_record.data_block_size = ds; }

◆ operator<< [1/3]

std::ofstream & operator<< ( std::ofstream & os,
DataSeparatorRecord & record )
friend

Definition at line 239 of file RawFileUtil.cxx.

239 {
240 // write data block
241 if ( os.write( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
242 {
243 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
244 throw FailedToWrite( "DataSeparatorRecord" );
245 }
246
247 return os;
248}

◆ operator<< [2/3]

std::ofstream & operator<< ( std::ofstream & os,
DataSeparatorRecord & record )
friend

Definition at line 239 of file RawFileUtil.cxx.

239 {
240 // write data block
241 if ( os.write( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
242 {
243 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
244 throw FailedToWrite( "DataSeparatorRecord" );
245 }
246
247 return os;
248}

◆ operator<< [3/3]

std::ofstream & operator<< ( std::ofstream & os,
DataSeparatorRecord & record )
friend

Definition at line 239 of file RawFileUtil.cxx.

239 {
240 // write data block
241 if ( os.write( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
242 {
243 std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
244 throw FailedToWrite( "DataSeparatorRecord" );
245 }
246
247 return os;
248}

◆ operator>> [1/3]

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

Definition at line 108 of file RawFileUtil.cxx.

108 {
109 // read data block
110 if ( is.read( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
111 {
112 // std::cerr << "[RawFile] Error occurred while reading file" << std::endl;
113 throw BadInputStream( "DataSeparatorRecord" );
114 // throw ReachEndOfFile();
115 }
116
117 // data validation checks
118 if ( record.m_record.marker != 0x1234cccc )
119 {
120 if ( record.m_record.marker == 0x1234dddd )
121 { throw ReachEndOfFile( is.currentFile().c_str() ); }
122 // std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
123 throw WrongMarker( 0x1234cccc, record.m_record.marker );
124 }
125
126 if ( record.m_record.record_size != 4 )
127 {
128 // std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
129 throw UnexpectedRecordSize( "DataSeparatorRecord", 4, record.m_record.record_size );
130 }
131
132 return is;
133}

◆ operator>> [2/3]

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

Definition at line 108 of file RawFileUtil.cxx.

108 {
109 // read data block
110 if ( is.read( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
111 {
112 // std::cerr << "[RawFile] Error occurred while reading file" << std::endl;
113 throw BadInputStream( "DataSeparatorRecord" );
114 // throw ReachEndOfFile();
115 }
116
117 // data validation checks
118 if ( record.m_record.marker != 0x1234cccc )
119 {
120 if ( record.m_record.marker == 0x1234dddd )
121 { throw ReachEndOfFile( is.currentFile().c_str() ); }
122 // std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
123 throw WrongMarker( 0x1234cccc, record.m_record.marker );
124 }
125
126 if ( record.m_record.record_size != 4 )
127 {
128 // std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
129 throw UnexpectedRecordSize( "DataSeparatorRecord", 4, record.m_record.record_size );
130 }
131
132 return is;
133}

◆ operator>> [3/3]

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

Definition at line 108 of file RawFileUtil.cxx.

108 {
109 // read data block
110 if ( is.read( (char*)( &record.m_record ), sizeof( data_separator_record ) ).fail() )
111 {
112 // std::cerr << "[RawFile] Error occurred while reading file" << std::endl;
113 throw BadInputStream( "DataSeparatorRecord" );
114 // throw ReachEndOfFile();
115 }
116
117 // data validation checks
118 if ( record.m_record.marker != 0x1234cccc )
119 {
120 if ( record.m_record.marker == 0x1234dddd )
121 { throw ReachEndOfFile( is.currentFile().c_str() ); }
122 // std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
123 throw WrongMarker( 0x1234cccc, record.m_record.marker );
124 }
125
126 if ( record.m_record.record_size != 4 )
127 {
128 // std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
129 throw UnexpectedRecordSize( "DataSeparatorRecord", 4, record.m_record.record_size );
130 }
131
132 return is;
133}

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