CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< edm::streamer::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_(std::make_shared<edm::streamer::OutputFile>(name)) {
8  streamerfile_->set_do_adler(true);
9 }
edm::propagate_const< std::shared_ptr< edm::streamer::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(), and evf::GlobalEvFOutputModule::globalBeginRun().

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

Definition at line 57 of file StreamerOutputFile.h.

References streamerfile_.

Referenced by evf::EvFOutputModule::beginRun(), evf::GlobalEvFOutputModule::globalBeginRun(), esMonitoring.AsyncLineReaderMixin::handle_close(), and esMonitoring.FDJsonServer::handle_close().

57 { streamerfile_->close(); }
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_
void StreamerOutputFile::write ( const InitMsgBuilder inview)

Definition at line 52 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

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

52  {
53  InitMsgView tmpView(inview.startAddress());
54  return write(tmpView);
55 }
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 57 of file StreamerOutputFile.cc.

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

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

Definition at line 11 of file StreamerOutputFile.cc.

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

11  {
12  EventMsgView tmpView(ineview.startAddress());
13  return write(tmpView);
14 }
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 16 of file StreamerOutputFile.cc.

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

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

Offset where current event starts

Definition at line 30 of file StreamerOutputFile.cc.

References Exception, runTheMatrix::ret, and streamerfile_.

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

Definition at line 43 of file StreamerOutputFile.cc.

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

Referenced by write().

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

Definition at line 67 of file StreamerOutputFile.cc.

References Exception, runTheMatrix::ret, and streamerfile_.

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

Definition at line 76 of file StreamerOutputFile.cc.

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

Referenced by write().

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

Member Data Documentation

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