CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamerOutputFile.cc
Go to the documentation of this file.
3 
5  }
6 
8  streamerfile_(new OutputFile(name))
9  {
10  streamerfile_->set_do_adler(1);
11  }
12 
14  {
15  EventMsgView tmpView(ineview.startAddress());
16  return write(tmpView);
17  }
18 
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  }
35 
37  writeEventFragment(uint32 fragIndex, uint32 fragCount,
38  const char *dataPtr, uint32 dataSize)
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  }
52 
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  }
65 
67  {
68  InitMsgView tmpView(inview.startAddress());
69  return write(tmpView);
70  }
71 
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  }
84 
86  writeInitFragment(uint32 fragIndex, uint32 fragCount,
87  const char *dataPtr, uint32 dataSize)
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  }
97 
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  }
110 
const uint8 * eventData() const
Definition: EventMessage.h:82
uint8 * startAddress() const
Definition: EventMessage.h:83
const uint8 * descData() const
Definition: InitMessage.h:93
uint64 writeEventFragment(uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
void write(const InitMsgBuilder &)
uint8 * startAddress() const
uint8 * startAddress() const
Definition: InitMessage.h:74
void writeEventHeader(const EventMsgView &ineview)
uint32 headerSize() const
Definition: EventMessage.h:85
unsigned int uint32
Definition: MsgTools.h:13
std::shared_ptr< OutputFile > streamerfile_
StreamerOutputFile(const std::string &name)
uint32 headerSize() const
Definition: InitMessage.h:94
unsigned long long uint64
Definition: MsgTools.h:14
uint32 size() const
Definition: EventMessage.h:80
void writeInitFragment(uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
uint8 * startAddress() const
uint32 size() const
Definition: InitMessage.h:73
void writeStart(const InitMsgView &inview)