00001 #ifndef IOPool_Streamer_StreamerOutputFile_h 00002 #define IOPool_Streamer_StreamerOutputFile_h 00003 00006 #include "IOPool/Streamer/interface/MsgTools.h" 00007 00008 #include "IOPool/Streamer/interface/InitMsgBuilder.h" 00009 #include "IOPool/Streamer/interface/InitMessage.h" 00010 00011 #include "IOPool/Streamer/interface/EventMsgBuilder.h" 00012 #include "IOPool/Streamer/interface/EventMessage.h" 00013 00014 #include "IOPool/Streamer/interface/StreamerFileIO.h" 00015 #include "boost/shared_ptr.hpp" 00016 00017 #include <exception> 00018 #include <fstream> 00019 #include <iostream> 00020 00021 class StreamerOutputFile 00025 { 00026 public: 00027 explicit StreamerOutputFile(const std::string& name); 00031 ~StreamerOutputFile(); 00032 00033 void write(const InitMsgBuilder&); 00038 void write(const InitMsgView&); 00039 00040 void writeInitFragment(uint32 fragIndex, uint32 fragCount, 00041 const char *dataPtr, uint32 dataSize); 00042 00043 uint64 write(const EventMsgBuilder&); 00050 uint64 write(const EventMsgView&); 00051 00052 uint64 writeEventFragment(uint32 fragIndex, uint32 fragCount, 00053 const char *dataPtr, uint32 dataSize); 00054 00055 //Returns how many bytes were written out 00056 uint32 writeEOF(uint32 statusCode, 00057 const std::vector<uint32>& hltStats); 00058 00059 uint32 adler32() const { return streamerfile_->adler32(); } 00060 00061 private: 00062 void writeEventHeader(const EventMsgView& ineview); 00063 void writeStart(const InitMsgView& inview); 00064 00065 private: 00066 boost::shared_ptr<OutputFile> streamerfile_; 00067 }; 00068 00069 #endif