CMS 3D CMS Logo

StreamerOutputFile.cc
Go to the documentation of this file.
3 
4 namespace edm::streamer {
6 
8  : streamerfile_(std::make_shared<edm::streamer::OutputFile>(name, padding)) {
9  streamerfile_->set_do_adler(true);
10  }
11 
13  EventMsgView tmpView(ineview.startAddress());
14  return write(tmpView);
15  }
16 
19  uint64 offset_to_return = streamerfile_->current_offset();
20 
21  writeEventHeader(ineview);
22  bool ret = streamerfile_->write((const char*)ineview.eventData(), ineview.size() - ineview.headerSize(), true);
23  if (ret) {
24  throw cms::Exception("OutputFile", "write(EventMsgView)")
25  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
26  << "is full?" << std::endl;
27  }
28  return offset_to_return;
29  }
30 
32  uint32 fragCount,
33  const char* dataPtr,
34  uint32 dataSize) {
36  uint64 offset_to_return = streamerfile_->current_offset();
37 
38  bool ret = streamerfile_->write(dataPtr, dataSize);
39  if (ret) {
40  throw cms::Exception("OutputFile", "writeEventFragment()")
41  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
42  << "is full?" << std::endl;
43  }
44  return offset_to_return;
45  }
46 
48  bool ret = streamerfile_->write((const char*)ineview.startAddress(), ineview.headerSize());
49  if (ret) {
50  throw cms::Exception("OutputFile", "writeEventHeader")
51  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
52  << "is full?" << std::endl;
53  }
54  }
55 
57  InitMsgView tmpView(inview.startAddress());
58  return write(tmpView);
59  }
60 
61  void StreamerOutputFile::write(const InitMsgView& inview) {
62  writeStart(inview);
63  bool ret = streamerfile_->write((const char*)inview.descData(), inview.size() - inview.headerSize(), true);
64  if (ret) {
65  throw cms::Exception("OutputFile", "write(InitMsgView)")
66  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
67  << "is full?" << std::endl;
68  }
69  }
70 
71  void StreamerOutputFile::writeInitFragment(uint32 fragIndex, uint32 fragCount, const char* dataPtr, uint32 dataSize) {
72  bool ret = streamerfile_->write((const char*)dataPtr, dataSize);
73  if (ret) {
74  throw cms::Exception("OutputFile", "writeInitFragment()")
75  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
76  << "is full?" << std::endl;
77  }
78  }
79 
81  bool ret = streamerfile_->write((const char*)inview.startAddress(), inview.headerSize());
82  if (ret) {
83  throw cms::Exception("OutputFile", "writeStart")
84  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
85  << "is full?" << std::endl;
86  }
87  }
88 } // namespace edm::streamer
const uint8 * eventData() const
Definition: EventMessage.h:79
ret
prodAgent to be discontinued
uint32 headerSize() const
Definition: InitMessage.h:88
uint64 writeEventFragment(uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
void write(const InitMsgBuilder &)
const uint8 * descData() const
Definition: InitMessage.h:87
void writeEventHeader(const EventMsgView &ineview)
void writeStart(const InitMsgView &inview)
uint8 * startAddress() const
Definition: EventMessage.h:80
StreamerOutputFile(const std::string &name, uint32 padding=0)
uint8 * startAddress() const
Definition: InitMessage.h:68
unsigned long long uint64
Definition: MsgTools.h:15
HLT enums.
void writeInitFragment(uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
edm::propagate_const< std::shared_ptr< edm::streamer::OutputFile > > streamerfile_
unsigned int uint32
Definition: MsgTools.h:14