Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef IOPool_Streamer_StreamerFileIO_h
0002 #define IOPool_Streamer_StreamerFileIO_h
0003 
0004 /**
0005 This file contains Class definitions for the 
0006 Class representing Output (Streamer) file.
0007 */
0008 
0009 #include "IOPool/Streamer/interface/MsgTools.h"
0010 #include "FWCore/Utilities/interface/propagate_const.h"
0011 #include <memory>
0012 #include <iosfwd>
0013 #include <string>
0014 
0015 //-------------------------------------------------------
0016 namespace edm::streamer {
0017   class OutputFile
0018   /**
0019   Class representing Output (Streamer) file.
0020   */
0021   {
0022   public:
0023     explicit OutputFile(const std::string& name);
0024     /**
0025       CTOR, takes file path name as argument
0026      */
0027     ~OutputFile();
0028 
0029     bool write(const char* ptr, size_t n);
0030 
0031     std::string fileName() const { return filename_; }
0032     uint64 current_offset() const { return current_offset_; }
0033     uint32 adler32() const { return (adlerb_ << 16) | adlera_; }
0034 
0035     void set_do_adler(bool v) { do_adler_ = v; }
0036     void set_current_offset(uint64 v) { current_offset_ = v; }
0037     void close();
0038 
0039   private:
0040     uint64 current_offset_; /** Location of current ioptr */
0041 
0042     bool do_adler_;
0043     uint32 adlera_;
0044     uint32 adlerb_;
0045 
0046     edm::propagate_const<std::shared_ptr<std::ofstream>> ost_;
0047     std::string filename_;
0048   };
0049 }  // namespace edm::streamer
0050 #endif