Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

FileEndRecord Class Reference

#include <RawFileUtil.h>

List of all members.

Public Member Functions

void dump (std::ostream &os=std::cout) const
void dump (std::ostream &os=std::cout) const
 FileEndRecord ()
 FileEndRecord ()
const file_end_recordgetRecord () const
const file_end_recordgetRecord () const
void setDataInFile (uint32_t file_size)
void setDataInFile (uint32_t file_size)
void setDataInRun (uint32_t run_size)
void setDataInRun (uint32_t run_size)
void setEventsInFile (uint32_t file_nevt)
void setEventsInFile (uint32_t file_nevt)
void setEventsInRun (uint32_t run_nevt)
void setEventsInRun (uint32_t run_nevt)
void setStatus (uint32_t status)
void setStatus (uint32_t status)

Private Attributes

file_end_record m_record

Friends

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


Constructor & Destructor Documentation

FileEndRecord::FileEndRecord  ) 
 

00277 {
00278    m_record.marker          = 0x1234dddd;
00279    m_record.record_size     = 10;
00280    // following members are not meaningful @ offline
00281    m_record.date            = 0;
00282    m_record.time            = 0;
00283    //m_record.events_in_file;     //set manually
00284    m_record.data_in_file    = 0;
00285    m_record.events_in_run   = 0;
00286    m_record.data_in_run     = 0;
00287    m_record.status          = 1;
00288    m_record.end_marker      = 0x1234eeee;
00289 }

FileEndRecord::FileEndRecord  ) 
 


Member Function Documentation

void FileEndRecord::dump std::ostream os = std::cout  )  const
 

void FileEndRecord::dump std::ostream os = std::cout  )  const
 

00337                                              {
00338   os << "[RawFile] FileEndRecord:" << std::endl << std::hex
00339      << "[RawFile] \tmarker               : 0x" << m_record.marker << std::endl
00340      << "[RawFile] \trecord_size          : 0x" << m_record.record_size << std::endl
00341      << "[RawFile] \tdate                 : 0x" << m_record.date << std::endl
00342      << "[RawFile] \ttime                 : 0x" << m_record.time << std::endl
00343      << "[RawFile] \tevents_in_file       : 0x" << m_record.events_in_file << std::endl
00344      << "[RawFile] \tdata_in_file         : 0x" << m_record.data_in_file << std::endl
00345      << "[RawFile] \tevents_in_run        : 0x" << m_record.events_in_run << std::endl
00346      << "[RawFile] \tdata_in_run          : 0x" << m_record.data_in_run << std::endl
00347      << "[RawFile] \tstatus               : 0x" << m_record.status << std::endl
00348      << "[RawFile] \tend_marker           : 0x" << m_record.end_marker
00349      << std::dec << std::endl;
00350 }

const file_end_record& FileEndRecord::getRecord  )  const [inline]
 

00166 { return m_record; }

const file_end_record& FileEndRecord::getRecord  )  const [inline]
 

00166 { return m_record; }

void FileEndRecord::setDataInFile uint32_t  file_size  )  [inline]
 

00170 { m_record.data_in_file = file_size; }

void FileEndRecord::setDataInFile uint32_t  file_size  )  [inline]
 

00170 { m_record.data_in_file = file_size; }

void FileEndRecord::setDataInRun uint32_t  run_size  )  [inline]
 

00172 { m_record.data_in_run = run_size; }

void FileEndRecord::setDataInRun uint32_t  run_size  )  [inline]
 

00172 { m_record.data_in_run = run_size; }

void FileEndRecord::setEventsInFile uint32_t  file_nevt  )  [inline]
 

00169 { m_record.events_in_file = file_nevt; }

void FileEndRecord::setEventsInFile uint32_t  file_nevt  )  [inline]
 

00169 { m_record.events_in_file = file_nevt; }

void FileEndRecord::setEventsInRun uint32_t  run_nevt  )  [inline]
 

00171 { m_record.events_in_run = run_nevt; }

void FileEndRecord::setEventsInRun uint32_t  run_nevt  )  [inline]
 

00171 { m_record.events_in_run = run_nevt; }

void FileEndRecord::setStatus uint32_t  status  )  [inline]
 

00173 { m_record.status = status; }

void FileEndRecord::setStatus uint32_t  status  )  [inline]
 

00173 { m_record.status = status; }


Friends And Related Function Documentation

raw_ifstream& makeEndRecord DataSeparatorRecord sep,
raw_ifstream is,
FileEndRecord record
[friend]
 

00146                                                                                                {
00147   // copy file_end_record data that already read by data_separator_record
00148   memcpy((void*)&record.m_record, (const void*)&(sep.getRecord()), sizeof(data_separator_record));
00149   // read data block
00150   if (is.read((char*)(&record.m_record.events_in_file), (
00151           sizeof(file_end_record) - sizeof(data_separator_record)
00152           )).fail()) {
00153     //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
00154     throw BadInputStream("FileEndRecord");
00155   }
00156 
00157   // data validation checks
00158   if (record.m_record.marker != 0x1234dddd) {
00159     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00160     throw WrongMarker(0x1234dddd, record.m_record.marker);
00161   }
00162   if (record.m_record.end_marker != 0x1234eeee) {
00163     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00164     throw WrongMarker(0x1234eeee, record.m_record.end_marker);
00165   }
00166 
00167   if (record.m_record.record_size != 10) {
00168     //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
00169     throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size);
00170   }
00171 
00172   return is;
00173 }

raw_ifstream& makeEndRecord DataSeparatorRecord sep,
raw_ifstream is,
FileEndRecord record
[friend]
 

00146                                                                                                {
00147   // copy file_end_record data that already read by data_separator_record
00148   memcpy((void*)&record.m_record, (const void*)&(sep.getRecord()), sizeof(data_separator_record));
00149   // read data block
00150   if (is.read((char*)(&record.m_record.events_in_file), (
00151           sizeof(file_end_record) - sizeof(data_separator_record)
00152           )).fail()) {
00153     //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
00154     throw BadInputStream("FileEndRecord");
00155   }
00156 
00157   // data validation checks
00158   if (record.m_record.marker != 0x1234dddd) {
00159     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00160     throw WrongMarker(0x1234dddd, record.m_record.marker);
00161   }
00162   if (record.m_record.end_marker != 0x1234eeee) {
00163     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00164     throw WrongMarker(0x1234eeee, record.m_record.end_marker);
00165   }
00166 
00167   if (record.m_record.record_size != 10) {
00168     //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
00169     throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size);
00170   }
00171 
00172   return is;
00173 }

raw_ofstream& operator<< raw_ofstream os,
FileEndRecord record
[friend]
 

00222                                                                   {
00223   // write data block
00224   if (os.write((char*)(&record.m_record), sizeof(file_end_record)).fail()) {
00225     std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
00226     throw FailedToWrite("FileEndRecord");
00227   }
00228 
00229   return os;
00230 }

raw_ofstream& operator<< raw_ofstream os,
FileEndRecord record
[friend]
 

00222                                                                   {
00223   // write data block
00224   if (os.write((char*)(&record.m_record), sizeof(file_end_record)).fail()) {
00225     std::cerr << "[RawFile] Error occurred while writing file" << std::endl;
00226     throw FailedToWrite("FileEndRecord");
00227   }
00228 
00229   return os;
00230 }

raw_ifstream& operator>> raw_ifstream is,
FileEndRecord record
[friend]
 

00121                                                                   {
00122   // read data block
00123   if (is.read((char*)(&record.m_record), sizeof(file_end_record)).fail()) {
00124     //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
00125     throw BadInputStream("FileEndRecord");
00126   }
00127 
00128   // data validation checks
00129   if (record.m_record.marker != 0x1234dddd) {
00130     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00131     throw WrongMarker(0x1234dddd, record.m_record.marker);
00132   }
00133   if (record.m_record.end_marker != 0x1234eeee) {
00134     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00135     throw WrongMarker(0x1234eeee, record.m_record.end_marker);
00136   }
00137 
00138   if (record.m_record.record_size != 10) {
00139     //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
00140     throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size);
00141   }
00142 
00143   return is;
00144 }

raw_ifstream& operator>> raw_ifstream is,
FileEndRecord record
[friend]
 

00121                                                                   {
00122   // read data block
00123   if (is.read((char*)(&record.m_record), sizeof(file_end_record)).fail()) {
00124     //std::cerr << "[RawFile] Error occurred while reading files" << std::endl;
00125     throw BadInputStream("FileEndRecord");
00126   }
00127 
00128   // data validation checks
00129   if (record.m_record.marker != 0x1234dddd) {
00130     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00131     throw WrongMarker(0x1234dddd, record.m_record.marker);
00132   }
00133   if (record.m_record.end_marker != 0x1234eeee) {
00134     //std::cerr << "[RawFile] Get an invalid record marker" << std::endl;
00135     throw WrongMarker(0x1234eeee, record.m_record.end_marker);
00136   }
00137 
00138   if (record.m_record.record_size != 10) {
00139     //std::cerr << "[RawFile] Get an unexpected record size" << std::endl;
00140     throw UnexpectedRecordSize("FileEndRecord", 10, record.m_record.record_size);
00141   }
00142 
00143   return is;
00144 }


Member Data Documentation

file_end_record FileEndRecord::m_record [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:15:13 2011 for BOSS6.5.5 by  doxygen 1.3.9.1