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, uint32 padding=0)
 
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::StreamerOutputFile ( const std::string &  name,
uint32  padding = 0 
)
explicit

Definition at line 6 of file StreamerOutputFile.cc.

References streamerfile_.

7  : streamerfile_(std::make_shared<edm::streamer::OutputFile>(name, padding)) {
8  streamerfile_->set_do_adler(true);
9 }
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_

◆ ~StreamerOutputFile()

StreamerOutputFile::~StreamerOutputFile ( )

CTOR, takes file path name as argument

Definition at line 4 of file StreamerOutputFile.cc.

4 {}

Member Function Documentation

◆ adler32()

uint32 StreamerOutputFile::adler32 ( ) const
inline

Definition at line 55 of file StreamerOutputFile.h.

References streamerfile_.

Referenced by evf::GlobalEvFOutputModule::globalBeginRun().

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

◆ close()

void StreamerOutputFile::close ( void  )
inline

Definition at line 57 of file StreamerOutputFile.h.

References streamerfile_.

Referenced by 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_

◆ write() [1/4]

void StreamerOutputFile::write ( const InitMsgBuilder inview)

Definition at line 52 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

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

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

◆ write() [2/4]

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(), true);
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 }
const uint8 * descData() const
Definition: InitMessage.h:86
ret
prodAgent to be discontinued
uint32 size() const
Definition: InitMessage.h:66
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:87
void writeStart(const InitMsgView &inview)

◆ write() [3/4]

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

◆ write() [4/4]

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(), true);
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 }
const uint8 * eventData() const
Definition: EventMessage.h:79
ret
prodAgent to be discontinued
uint32 size() const
Definition: EventMessage.h:77
uint32 headerSize() const
Definition: EventMessage.h:82
void writeEventHeader(const EventMsgView &ineview)
unsigned long long uint64
Definition: MsgTools.h:14
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_

◆ writeEventFragment()

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 }
ret
prodAgent to be discontinued
unsigned long long uint64
Definition: MsgTools.h:14
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_

◆ writeEventHeader()

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 }
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_

◆ writeInitFragment()

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 }
ret
prodAgent to be discontinued
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_

◆ writeStart()

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 }
ret
prodAgent to be discontinued
uint8 * startAddress() const
Definition: InitMessage.h:67
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:87

Member Data Documentation

◆ streamerfile_

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