CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
StreamerOutputFile Class Reference

#include <StreamerOutputFile.h>

Public Member Functions

uint32 adler32 () const
 
void close ()
 
 StreamerOutputFile (const std::string &name)
 
void write (const InitMsgBuilder &)
 
void write (const InitMsgView &)
 
uint64 write (const EventMsgBuilder &)
 
uint64 write (const EventMsgView &)
 
uint64 writeEventFragment (uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
 
void writeInitFragment (uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
 
 ~StreamerOutputFile ()
 

Private Member Functions

void writeEventHeader (const EventMsgView &ineview)
 
void writeStart (const InitMsgView &inview)
 

Private Attributes

edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
 

Detailed Description

StreamerOutputFile: Class for doing Streamer Write operations Class for doing Streamer Write operations

Definition at line 23 of file StreamerOutputFile.h.

Constructor & Destructor Documentation

StreamerOutputFile::StreamerOutputFile ( const std::string &  name)
explicit

Definition at line 6 of file StreamerOutputFile.cc.

References streamerfile_.

7  streamerfile_->set_do_adler(true);
8 }
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
StreamerOutputFile::~StreamerOutputFile ( )

CTOR, takes file path name as argument

Definition at line 4 of file StreamerOutputFile.cc.

4 {}

Member Function Documentation

uint32 StreamerOutputFile::adler32 ( ) const
inline

Definition at line 55 of file StreamerOutputFile.h.

References streamerfile_.

Referenced by evf::EvFOutputModule::beginRun().

55 { return streamerfile_->adler32(); }
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
void StreamerOutputFile::close ( void  )
inline
void StreamerOutputFile::write ( const InitMsgBuilder inview)

Definition at line 51 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

Referenced by evf::EvFOutputModule::beginRun(), and write().

51  {
52  InitMsgView tmpView(inview.startAddress());
53  return write(tmpView);
54 }
void write(const InitMsgBuilder &)
uint8 * startAddress() const
void StreamerOutputFile::write ( const InitMsgView inview)

Performs write on InitMsgBuilder type, Header + Blob, both are written out.

Definition at line 56 of file StreamerOutputFile.cc.

References InitMsgView::descData(), Exception, InitMsgView::headerSize(), InitMsgView::size(), streamerfile_, and writeStart().

56  {
57  writeStart(inview);
58  bool ret = streamerfile_->write((const char*)inview.descData(), inview.size() - inview.headerSize());
59  if (ret) {
60  throw cms::Exception("OutputFile", "write(InitMsgView)")
61  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
62  << "is full?" << std::endl;
63  }
64 }
const uint8 * descData() const
Definition: InitMessage.h:86
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:87
uint32 size() const
Definition: InitMessage.h:66
void writeStart(const InitMsgView &inview)
uint64 StreamerOutputFile::write ( const EventMsgBuilder ineview)

Definition at line 10 of file StreamerOutputFile.cc.

References EventMsgBuilder::startAddress(), and write().

10  {
11  EventMsgView tmpView(ineview.startAddress());
12  return write(tmpView);
13 }
void write(const InitMsgBuilder &)
uint8 * startAddress() const
uint64 StreamerOutputFile::write ( const EventMsgView ineview)

Performs write on EventMsgBuilder type, Header + Blob, both are written out. RETURNS the Offset in Stream while at which EventForOutputwas written.

Offset where current event starts

Definition at line 15 of file StreamerOutputFile.cc.

References EventMsgView::eventData(), Exception, EventMsgView::headerSize(), EventMsgView::size(), streamerfile_, and writeEventHeader().

15  {
17  uint64 offset_to_return = streamerfile_->current_offset();
18 
19  writeEventHeader(ineview);
20  bool ret = streamerfile_->write((const char*)ineview.eventData(), ineview.size() - ineview.headerSize());
21  if (ret) {
22  throw cms::Exception("OutputFile", "write(EventMsgView)")
23  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
24  << "is full?" << std::endl;
25  }
26  return offset_to_return;
27 }
const uint8 * eventData() const
Definition: EventMessage.h:79
void writeEventHeader(const EventMsgView &ineview)
uint32 headerSize() const
Definition: EventMessage.h:82
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
unsigned long long uint64
Definition: MsgTools.h:14
uint32 size() const
Definition: EventMessage.h:77
uint64 StreamerOutputFile::writeEventFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Offset where current event starts

Definition at line 29 of file StreamerOutputFile.cc.

References Exception, and streamerfile_.

29  {
31  uint64 offset_to_return = streamerfile_->current_offset();
32 
33  bool ret = streamerfile_->write(dataPtr, dataSize);
34  if (ret) {
35  throw cms::Exception("OutputFile", "writeEventFragment()")
36  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
37  << "is full?" << std::endl;
38  }
39  return offset_to_return;
40 }
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
unsigned long long uint64
Definition: MsgTools.h:14
void StreamerOutputFile::writeEventHeader ( const EventMsgView ineview)
private

Definition at line 42 of file StreamerOutputFile.cc.

References Exception, EventMsgView::headerSize(), EventMsgView::startAddress(), and streamerfile_.

Referenced by close(), and write().

42  {
43  bool ret = streamerfile_->write((const char*)ineview.startAddress(), ineview.headerSize());
44  if (ret) {
45  throw cms::Exception("OutputFile", "writeEventHeader")
46  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
47  << "is full?" << std::endl;
48  }
49 }
uint8 * startAddress() const
Definition: EventMessage.h:80
uint32 headerSize() const
Definition: EventMessage.h:82
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
void StreamerOutputFile::writeInitFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Definition at line 66 of file StreamerOutputFile.cc.

References Exception, and streamerfile_.

66  {
67  bool ret = streamerfile_->write((const char*)dataPtr, dataSize);
68  if (ret) {
69  throw cms::Exception("OutputFile", "writeInitFragment()")
70  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
71  << "is full?" << std::endl;
72  }
73 }
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
void StreamerOutputFile::writeStart ( const InitMsgView inview)
private

Definition at line 75 of file StreamerOutputFile.cc.

References Exception, InitMsgView::headerSize(), InitMsgView::startAddress(), and streamerfile_.

Referenced by close(), and write().

75  {
76  bool ret = streamerfile_->write((const char*)inview.startAddress(), inview.headerSize());
77  if (ret) {
78  throw cms::Exception("OutputFile", "writeStart")
79  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
80  << "is full?" << std::endl;
81  }
82 }
uint8 * startAddress() const
Definition: InitMessage.h:67
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:87

Member Data Documentation

edm::propagate_const<std::shared_ptr<OutputFile> > StreamerOutputFile::streamerfile_
private