Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-22 04:08:30

0001 #ifndef IOPool_Streamer_StreamerOutputFile_h
0002 #define IOPool_Streamer_StreamerOutputFile_h
0003 
0004 /** StreamerOutputFile: Class for doing Streamer Write operations */
0005 
0006 #include "FWCore/Utilities/interface/propagate_const.h"
0007 
0008 #include "IOPool/Streamer/interface/MsgTools.h"
0009 
0010 #include "IOPool/Streamer/interface/InitMsgBuilder.h"
0011 #include "IOPool/Streamer/interface/InitMessage.h"
0012 
0013 #include "IOPool/Streamer/interface/EventMsgBuilder.h"
0014 #include "IOPool/Streamer/interface/EventMessage.h"
0015 
0016 #include "IOPool/Streamer/interface/StreamerFileIO.h"
0017 #include <memory>
0018 
0019 #include <exception>
0020 #include <fstream>
0021 #include <iostream>
0022 
0023 class StreamerOutputFile
0024 /**
0025   Class for doing Streamer Write operations
0026   */
0027 {
0028 public:
0029   explicit StreamerOutputFile(const std::string& name);
0030   /**
0031       CTOR, takes file path name as argument
0032      */
0033   ~StreamerOutputFile();
0034 
0035   void write(const InitMsgBuilder&);
0036   /**
0037       Performs write on InitMsgBuilder type,
0038       Header + Blob, both are written out.
0039      */
0040   void write(const InitMsgView&);
0041 
0042   void writeInitFragment(uint32 fragIndex, uint32 fragCount, const char* dataPtr, uint32 dataSize);
0043 
0044   uint64 write(const EventMsgBuilder&);
0045   /**
0046       Performs write on EventMsgBuilder type,
0047       Header + Blob, both are written out.
0048       RETURNS the Offset in Stream while at
0049               which EventForOutputwas written.
0050      */
0051   uint64 write(const EventMsgView&);
0052 
0053   uint64 writeEventFragment(uint32 fragIndex, uint32 fragCount, const char* dataPtr, uint32 dataSize);
0054 
0055   uint32 adler32() const { return streamerfile_->adler32(); }
0056 
0057   void close() { streamerfile_->close(); }
0058 
0059 private:
0060   void writeEventHeader(const EventMsgView& ineview);
0061   void writeStart(const InitMsgView& inview);
0062 
0063 private:
0064   edm::propagate_const<std::shared_ptr<edm::streamer::OutputFile>> streamerfile_;
0065 };
0066 
0067 #endif