CMS 3D CMS Logo

FRDEventFileWriter Class Reference

#include <IOPool/Streamer/interface/FRDEventFileWriter.h>

List of all members.

Public Member Functions

void doOutputEvent (FRDEventMsgView const &msg)
 FRDEventFileWriter (std::string const &fileName)
 FRDEventFileWriter (edm::ParameterSet const &ps)
void start ()
void stop ()
 ~FRDEventFileWriter ()

Private Member Functions

void initialize (std::string const &name)

Private Attributes

std::string fileName_
std::auto_ptr< std::ofstream > ost_


Detailed Description

Definition at line 11 of file FRDEventFileWriter.h.


Constructor & Destructor Documentation

FRDEventFileWriter::FRDEventFileWriter ( edm::ParameterSet const &  ps  )  [explicit]

Definition at line 7 of file FRDEventFileWriter.cc.

References edm::ParameterSet::getUntrackedParameter(), and initialize().

00008 {
00009   initialize(ps.getUntrackedParameter<std::string>("fileName", "testFRDfile.dat"));
00010 }

FRDEventFileWriter::FRDEventFileWriter ( std::string const &  fileName  )  [explicit]

Definition at line 12 of file FRDEventFileWriter.cc.

References initialize().

00013 {
00014   initialize(fileName);
00015 }

FRDEventFileWriter::~FRDEventFileWriter (  ) 

Definition at line 17 of file FRDEventFileWriter.cc.

References ost_.

00018 {
00019   ost_->close();
00020 }


Member Function Documentation

void FRDEventFileWriter::doOutputEvent ( FRDEventMsgView const &  msg  ) 

Definition at line 22 of file FRDEventFileWriter.cc.

References lat::endl(), Exception, fileName_, ost_, FRDEventMsgView::size(), and FRDEventMsgView::startAddress().

00023 {
00024   ost_->write((const char*) msg.startAddress(), msg.size());
00025   if (ost_->fail()) {
00026     throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
00027       << "Error writing FED Raw Data event data to "
00028       << fileName_ << ".  Possibly the output disk "
00029       << "is full?" << std::endl;
00030   }
00031 
00032   ost_->flush();
00033   if (ost_->fail()) {
00034     throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
00035       << "Error writing FED Raw Data event data to "
00036       << fileName_ << ".  Possibly the output disk "
00037       << "is full?" << std::endl;
00038   }
00039 }

void FRDEventFileWriter::initialize ( std::string const &  name  )  [private]

Definition at line 41 of file FRDEventFileWriter.cc.

References Exception, fileName_, ost_, and out.

Referenced by FRDEventFileWriter().

00042 {
00043   fileName_ = name;
00044   ost_.reset(new std::ofstream(name.c_str(), std::ios_base::binary | std::ios_base::out));
00045 
00046   if (!ost_->is_open()) {
00047     throw cms::Exception("FRDEventFileWriter","initialize")
00048       << "Error opening FED Raw Data event output file: " << name << "\n";
00049   }
00050 }

void FRDEventFileWriter::start ( void   )  [inline]

Definition at line 21 of file FRDEventFileWriter.h.

00021 {}

void FRDEventFileWriter::stop (  )  [inline]

Definition at line 22 of file FRDEventFileWriter.h.

00022 {}


Member Data Documentation

std::string FRDEventFileWriter::fileName_ [private]

Definition at line 29 of file FRDEventFileWriter.h.

Referenced by doOutputEvent(), and initialize().

std::auto_ptr<std::ofstream> FRDEventFileWriter::ost_ [private]

Definition at line 28 of file FRDEventFileWriter.h.

Referenced by doOutputEvent(), initialize(), and ~FRDEventFileWriter().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:02 2009 for CMSSW by  doxygen 1.5.4