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 &)
 
uint32 writeEOF (uint32 statusCode, const std::vector< uint32 > &hltStats)
 
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 8 of file StreamerOutputFile.cc.

References streamerfile_.

8  :
10  {
11  streamerfile_->set_do_adler(1);
12  }
boost::shared_ptr< OutputFile > streamerfile_
StreamerOutputFile::~StreamerOutputFile ( )

CTOR, takes file path name as argument

Definition at line 5 of file StreamerOutputFile.cc.

5  {
6  }

Member Function Documentation

uint32 StreamerOutputFile::adler32 ( ) const
inline

Definition at line 59 of file StreamerOutputFile.h.

References streamerfile_.

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

Definition at line 81 of file StreamerOutputFile.cc.

References InitMsgBuilder::startAddress().

Referenced by write().

82  {
83  InitMsgView tmpView(inview.startAddress());
84  return write(tmpView);
85  }
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 87 of file StreamerOutputFile.cc.

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

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

Definition at line 14 of file StreamerOutputFile.cc.

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

15  {
16  EventMsgView tmpView(ineview.startAddress());
17  return write(tmpView);
18  }
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 20 of file StreamerOutputFile.cc.

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

21  {
23  uint64 offset_to_return = streamerfile_->current_offset();
24 
26  streamerfile_->set_last_event_offset(streamerfile_->current_offset());
27 
28  writeEventHeader(ineview);
29  bool ret = streamerfile_->write((const char*) ineview.eventData(),
30  ineview.size() - ineview.headerSize());
31  if (ret) {
32  throw cms::Exception("OutputFile", "write(EventMsgView)")
33  << "Error writing streamer event data to "
34  << streamerfile_->fileName() << ". Possibly the output disk "
35  << "is full?" << std::endl;
36  }
37 
38  streamerfile_->inc_events();
39 
40  return offset_to_return;
41  }
const uint8 * eventData() const
Definition: EventMessage.h:78
boost::shared_ptr< OutputFile > streamerfile_
void writeEventHeader(const EventMsgView &ineview)
uint32 headerSize() const
Definition: EventMessage.h:81
unsigned long long uint64
Definition: MsgTools.h:14
uint32 size() const
Definition: EventMessage.h:76
uint32 StreamerOutputFile::writeEOF ( uint32  statusCode,
const std::vector< uint32 > &  hltStats 
)

Definition at line 135 of file StreamerOutputFile.cc.

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

137  {
138  EOFRecordBuilder eof(streamerfile_->run(),
139  streamerfile_->events(),
140  statusCode,
141  hltStats,
142  streamerfile_->first_event_offset(),
143  streamerfile_->last_event_offset());
144 
145  bool ret = streamerfile_->write((const char*)
146  eof.recAddress(),
147  eof.size());
148  if (ret) {
149  throw cms::Exception("OutputFile", "writeEOF")
150  << "Error writing streamer end-of-file to "
151  << streamerfile_->fileName() << ". Possibly the output disk "
152  << "is full?" << std::endl;
153  }
154  return eof.size();
155  }
boost::shared_ptr< OutputFile > streamerfile_
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 44 of file StreamerOutputFile.cc.

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

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

Definition at line 68 of file StreamerOutputFile.cc.

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

Referenced by write().

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

Offset of first event to be written

Definition at line 104 of file StreamerOutputFile.cc.

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

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

Definition at line 121 of file StreamerOutputFile.cc.

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

Referenced by write().

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

Member Data Documentation

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