test
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

boost::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  }
boost::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(); }
boost::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::write ( const InitMsgBuilder inview)

Definition at line 80 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

Referenced by write().

81  {
82  InitMsgView tmpView(inview.startAddress());
83  return write(tmpView);
84  }
void write(const InitMsgBuilder &)
uint8 * startAddress() const
void StreamerOutputFile::write ( const InitMsgView inview)

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

Offset of first event to be written

Definition at line 86 of file StreamerOutputFile.cc.

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

87  {
88  writeStart(inview);
89  bool ret = streamerfile_->write((const char*) inview.descData(),
90  inview.size() - inview.headerSize());
91  if (ret) {
92  throw cms::Exception("OutputFile", "write(InitMsgView)")
93  << "Error writing streamer header data to "
94  << streamerfile_->fileName() << ". Possibly the output disk "
95  << "is full?" << std::endl;
96  }
97 
99  streamerfile_->set_first_event_offset(streamerfile_->current_offset());
100  }
const uint8 * descData() const
Definition: InitMessage.h:91
boost::shared_ptr< OutputFile > streamerfile_
uint32 headerSize() const
Definition: InitMessage.h:92
uint32 size() const
Definition: InitMessage.h:71
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

Offset of last written event

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 
25  streamerfile_->set_last_event_offset(streamerfile_->current_offset());
26 
27  writeEventHeader(ineview);
28  bool ret = streamerfile_->write((const char*) ineview.eventData(),
29  ineview.size() - ineview.headerSize());
30  if (ret) {
31  throw cms::Exception("OutputFile", "write(EventMsgView)")
32  << "Error writing streamer event data to "
33  << streamerfile_->fileName() << ". Possibly the output disk "
34  << "is full?" << std::endl;
35  }
36 
37  streamerfile_->inc_events();
38 
39  return offset_to_return;
40  }
const uint8 * eventData() const
Definition: EventMessage.h:80
ULong64_t uint64
boost::shared_ptr< OutputFile > streamerfile_
void writeEventHeader(const EventMsgView &ineview)
uint32 headerSize() const
Definition: EventMessage.h:83
uint32 size() const
Definition: EventMessage.h:78
uint64 StreamerOutputFile::writeEventFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Offset where current event starts

Offset of last written event

Definition at line 43 of file StreamerOutputFile.cc.

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

45  {
47  uint64 offset_to_return = streamerfile_->current_offset();
48 
49  if (fragIndex == 0) {
51  streamerfile_->set_last_event_offset(streamerfile_->current_offset());
52  }
53 
54  bool ret = streamerfile_->write(dataPtr, dataSize);
55  if (ret) {
56  throw cms::Exception("OutputFile", "writeEventFragment()")
57  << "Error writing streamer event data to "
58  << streamerfile_->fileName() << ". Possibly the output disk "
59  << "is full?" << std::endl;
60  }
61 
62  if (fragIndex == fragCount-1) {streamerfile_->inc_events();}
63 
64  return offset_to_return;
65  }
ULong64_t uint64
boost::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::writeEventHeader ( const EventMsgView ineview)
private

Definition at line 67 of file StreamerOutputFile.cc.

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

Referenced by write().

68  {
69  bool ret = streamerfile_->write((const char*)
70  ineview.startAddress(),
71  ineview.headerSize()) ;
72  if (ret) {
73  throw cms::Exception("OutputFile", "writeEventHeader")
74  << "Error writing streamer event data to "
75  << streamerfile_->fileName() << ". Possibly the output disk "
76  << "is full?" << std::endl;
77  }
78  }
uint8 * startAddress() const
Definition: EventMessage.h:81
boost::shared_ptr< OutputFile > streamerfile_
uint32 headerSize() const
Definition: EventMessage.h:83
void StreamerOutputFile::writeInitFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Offset of first event to be written

Definition at line 103 of file StreamerOutputFile.cc.

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

105  {
106  bool ret = streamerfile_->write((const char*) dataPtr, dataSize);
107  if (ret) {
108  throw cms::Exception("OutputFile", "writeInitFragment()")
109  << "Error writing streamer header data to "
110  << streamerfile_->fileName() << ". Possibly the output disk "
111  << "is full?" << std::endl;
112  }
113 
114  if (fragIndex == fragCount-1) {
116  streamerfile_->set_first_event_offset(streamerfile_->current_offset());
117  }
118  }
boost::shared_ptr< OutputFile > streamerfile_
void StreamerOutputFile::writeStart ( const InitMsgView inview)
private

Definition at line 120 of file StreamerOutputFile.cc.

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

Referenced by write().

121  {
122  bool ret = streamerfile_->write((const char*)
123  inview.startAddress(),
124  inview.headerSize()) ;
125  if (ret) {
126  throw cms::Exception("OutputFile", "writeStart")
127  << "Error writing streamer header data to "
128  << streamerfile_->fileName() << ". Possibly the output disk "
129  << "is full?" << std::endl;
130  }
131  streamerfile_->set_run(inview.run());
132  }
boost::shared_ptr< OutputFile > streamerfile_
uint8 * startAddress() const
Definition: InitMessage.h:72
uint32 headerSize() const
Definition: InitMessage.h:92
uint32 run() const
Definition: InitMessage.cc:104

Member Data Documentation

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