DataSeparatorRecord Class Reference

#include <RawFileUtil.h>

List of all members.

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)

Private Attributes

data_separator_record m_record

Friends

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


Detailed Description

Definition at line 125 of file RawFileUtil.h.


Constructor & Destructor Documentation

DataSeparatorRecord::DataSeparatorRecord (  ) 

Definition at line 268 of file RawFileUtil.cxx.

References m_record, data_separator_record::marker, and data_separator_record::record_size.

00269 {
00270    m_record.marker        = 0x1234cccc;
00271    m_record.record_size   = 4;
00272    //m_record.data_block_number;  //set manually
00273    //m_record.data_block_size;    //set manually
00274 }


Member Function Documentation

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

Definition at line 328 of file RawFileUtil.cxx.

References data_separator_record::data_block_number, data_separator_record::data_block_size, m_record, data_separator_record::marker, and data_separator_record::record_size.

00328                                                    {
00329   os << "[RawFile] DataSeparatorRecord:" << std::endl << std::hex
00330      << "[RawFile] \tmarker               : 0x" << m_record.marker << std::endl
00331      << "[RawFile] \trecord_size          : 0x" << m_record.record_size << std::endl
00332      << "[RawFile] \tdata_block_number    : 0x" << m_record.data_block_number << std::endl
00333      << "[RawFile] \tdata_block_size      : 0x" << m_record.data_block_size
00334      << std::dec << std::endl;
00335 }

const data_separator_record& DataSeparatorRecord::getRecord (  )  const [inline]

Definition at line 132 of file RawFileUtil.h.

References m_record.

Referenced by makeEndRecord().

00132 { return m_record; }

void DataSeparatorRecord::setDataBlockNumber ( uint32_t  dn  )  [inline]

Definition at line 135 of file RawFileUtil.h.

References data_separator_record::data_block_number, and m_record.

Referenced by raw_ofstream::write_event().

00135 { m_record.data_block_number = dn; }

void DataSeparatorRecord::setDataBlockSize ( uint32_t  ds  )  [inline]

Definition at line 136 of file RawFileUtil.h.

References data_separator_record::data_block_size, and m_record.

Referenced by raw_ofstream::write_event().

00136 { m_record.data_block_size = ds; }


Friends And Related Function Documentation

raw_ofstream& operator<< ( raw_ofstream os,
DataSeparatorRecord record 
) [friend]

Definition at line 212 of file RawFileUtil.cxx.

00212                                                                         {
00213   // write data block
00214   if (os.write((char*)(&record.m_record), sizeof(data_separator_record)).fail()) {
00215     std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
00216     throw FailedToWrite("DataSeparatorRecord");
00217   }
00218 
00219   return os;
00220 }

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

Definition at line 96 of file RawFileUtil.cxx.

00096                                                                         {
00097   // read data block
00098   if (is.read((char*)(&record.m_record), sizeof(data_separator_record)).fail()) {
00099     //std::cerr << "[RawFile] Error occurred while reading file" << std::endl;
00100     throw BadInputStream("DataSeparatorRecord");
00101     //throw ReachEndOfFile();
00102   }
00103 
00104   // data validation checks
00105   if (record.m_record.marker != 0x1234cccc) {
00106     if (record.m_record.marker == 0x1234dddd) {
00107       throw ReachEndOfFile(is.currentFile().c_str());
00108     }
00109     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00110     throw WrongMarker(0x1234cccc, record.m_record.marker);
00111   }
00112 
00113   if (record.m_record.record_size != 4) {
00114     //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
00115     throw UnexpectedRecordSize("DataSeparatorRecord", 4, record.m_record.record_size);
00116   }
00117 
00118   return is;
00119 }


Member Data Documentation

data_separator_record DataSeparatorRecord::m_record [private]

Definition at line 139 of file RawFileUtil.h.

Referenced by DataSeparatorRecord(), dump(), getRecord(), operator<<(), operator>>(), setDataBlockNumber(), and setDataBlockSize().


Generated on Tue Nov 29 23:18:10 2016 for BOSS_7.0.2 by  doxygen 1.4.7