Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-31 04:19:41

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 namespace edm::streamer {
0024   class StreamerOutputFile
0025   /**
0026   Class for doing Streamer Write operations
0027   */
0028   {
0029   public:
0030     explicit StreamerOutputFile(const std::string& name, uint32 padding = 0);
0031     /**
0032       CTOR, takes file path name as argument
0033      */
0034     ~StreamerOutputFile();
0035 
0036     void write(const InitMsgBuilder&);
0037     /**
0038       Performs write on InitMsgBuilder type,
0039       Header + Blob, both are written out.
0040      */
0041     void write(const InitMsgView&);
0042 
0043     void writeInitFragment(uint32 fragIndex, uint32 fragCount, const char* dataPtr, uint32 dataSize);
0044 
0045     uint64 write(const EventMsgBuilder&);
0046     /**
0047       Performs write on EventMsgBuilder type,
0048       Header + Blob, both are written out.
0049       RETURNS the Offset in Stream while at
0050               which EventForOutputwas written.
0051      */
0052     uint64 write(const EventMsgView&);
0053 
0054     uint64 writeEventFragment(uint32 fragIndex, uint32 fragCount, const char* dataPtr, uint32 dataSize);
0055 
0056     uint32 adler32() const { return streamerfile_->adler32(); }
0057 
0058     void close() { streamerfile_->close(); }
0059 
0060   private:
0061     void writeEventHeader(const EventMsgView& ineview);
0062     void writeStart(const InitMsgView& inview);
0063 
0064   private:
0065     edm::propagate_const<std::shared_ptr<edm::streamer::OutputFile>> streamerfile_;
0066   };
0067 }  // namespace edm::streamer
0068 #endif