CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
 
 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

std::shared_ptr< OutputFilestreamerfile_
 

Detailed Description

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

Definition at line 21 of file StreamerOutputFile.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file StreamerOutputFile.cc.

References streamerfile_.

7  :
9  {
10  streamerfile_->set_do_adler(1);
11  }
std::shared_ptr< OutputFile > streamerfile_
StreamerOutputFile::~StreamerOutputFile ( )

CTOR, takes file path name as argument

Definition at line 4 of file StreamerOutputFile.cc.

4  {
5  }

Member Function Documentation

uint32 StreamerOutputFile::adler32 ( ) const
inline

Definition at line 55 of file StreamerOutputFile.h.

References streamerfile_.

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

Definition at line 66 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

Referenced by write().

67  {
68  InitMsgView tmpView(inview.startAddress());
69  return write(tmpView);
70  }
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 72 of file StreamerOutputFile.cc.

References InitMsgView::descData(), edm::hlt::Exception, InitMsgView::headerSize(), run_regression::ret, InitMsgView::size(), streamerfile_, and writeStart().

73  {
74  writeStart(inview);
75  bool ret = streamerfile_->write((const char*) inview.descData(),
76  inview.size() - inview.headerSize());
77  if (ret) {
78  throw cms::Exception("OutputFile", "write(InitMsgView)")
79  << "Error writing streamer header data to "
80  << streamerfile_->fileName() << ". Possibly the output disk "
81  << "is full?" << std::endl;
82  }
83  }
const uint8 * descData() const
Definition: InitMessage.h:93
std::shared_ptr< OutputFile > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:94
uint32 size() const
Definition: InitMessage.h:73
void writeStart(const InitMsgView &inview)
uint64 StreamerOutputFile::write ( const EventMsgBuilder ineview)

Definition at line 13 of file StreamerOutputFile.cc.

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

14  {
15  EventMsgView tmpView(ineview.startAddress());
16  return write(tmpView);
17  }
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 Event was written.

Offset where current event starts

Definition at line 19 of file StreamerOutputFile.cc.

References EventMsgView::eventData(), edm::hlt::Exception, EventMsgView::headerSize(), run_regression::ret, EventMsgView::size(), streamerfile_, and writeEventHeader().

20  {
22  uint64 offset_to_return = streamerfile_->current_offset();
23 
24  writeEventHeader(ineview);
25  bool ret = streamerfile_->write((const char*) ineview.eventData(),
26  ineview.size() - ineview.headerSize());
27  if (ret) {
28  throw cms::Exception("OutputFile", "write(EventMsgView)")
29  << "Error writing streamer event data to "
30  << streamerfile_->fileName() << ". Possibly the output disk "
31  << "is full?" << std::endl;
32  }
33  return offset_to_return;
34  }
const uint8 * eventData() const
Definition: EventMessage.h:82
ULong64_t uint64
void writeEventHeader(const EventMsgView &ineview)
uint32 headerSize() const
Definition: EventMessage.h:85
std::shared_ptr< OutputFile > streamerfile_
uint32 size() const
Definition: EventMessage.h:80
uint64 StreamerOutputFile::writeEventFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Offset where current event starts

Definition at line 37 of file StreamerOutputFile.cc.

References edm::hlt::Exception, run_regression::ret, and streamerfile_.

39  {
41  uint64 offset_to_return = streamerfile_->current_offset();
42 
43  bool ret = streamerfile_->write(dataPtr, dataSize);
44  if (ret) {
45  throw cms::Exception("OutputFile", "writeEventFragment()")
46  << "Error writing streamer event data to "
47  << streamerfile_->fileName() << ". Possibly the output disk "
48  << "is full?" << std::endl;
49  }
50  return offset_to_return;
51  }
ULong64_t uint64
std::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::writeEventHeader ( const EventMsgView ineview)
private

Definition at line 53 of file StreamerOutputFile.cc.

References edm::hlt::Exception, EventMsgView::headerSize(), run_regression::ret, EventMsgView::startAddress(), and streamerfile_.

Referenced by write().

54  {
55  bool ret = streamerfile_->write((const char*)
56  ineview.startAddress(),
57  ineview.headerSize()) ;
58  if (ret) {
59  throw cms::Exception("OutputFile", "writeEventHeader")
60  << "Error writing streamer event data to "
61  << streamerfile_->fileName() << ". Possibly the output disk "
62  << "is full?" << std::endl;
63  }
64  }
uint8 * startAddress() const
Definition: EventMessage.h:83
uint32 headerSize() const
Definition: EventMessage.h:85
std::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::writeInitFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Definition at line 86 of file StreamerOutputFile.cc.

References edm::hlt::Exception, run_regression::ret, and streamerfile_.

88  {
89  bool ret = streamerfile_->write((const char*) dataPtr, dataSize);
90  if (ret) {
91  throw cms::Exception("OutputFile", "writeInitFragment()")
92  << "Error writing streamer header data to "
93  << streamerfile_->fileName() << ". Possibly the output disk "
94  << "is full?" << std::endl;
95  }
96  }
std::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::writeStart ( const InitMsgView inview)
private

Definition at line 98 of file StreamerOutputFile.cc.

References edm::hlt::Exception, InitMsgView::headerSize(), run_regression::ret, InitMsgView::startAddress(), and streamerfile_.

Referenced by write().

99  {
100  bool ret = streamerfile_->write((const char*)
101  inview.startAddress(),
102  inview.headerSize()) ;
103  if (ret) {
104  throw cms::Exception("OutputFile", "writeStart")
105  << "Error writing streamer header data to "
106  << streamerfile_->fileName() << ". Possibly the output disk "
107  << "is full?" << std::endl;
108  }
109  }
uint8 * startAddress() const
Definition: InitMessage.h:74
std::shared_ptr< OutputFile > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:94

Member Data Documentation

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