00001 #ifndef IOPool_Streamer_StreamerFileIO_h 00002 #define IOPool_Streamer_StreamerFileIO_h 00003 00009 #include "IOPool/Streamer/interface/MsgTools.h" 00010 #include "boost/shared_ptr.hpp" 00011 #include <iosfwd> 00012 #include <string> 00013 00014 //------------------------------------------------------- 00015 00016 class OutputFile 00020 { 00021 public: 00022 explicit OutputFile(const std::string& name); 00026 ~OutputFile(); 00027 00028 bool write(const char *ptr, size_t n); 00029 00030 std::string fileName() const { return filename_; } 00031 uint64 current_offset() const { return current_offset_; } 00032 uint64 first_event_offset() const { return first_event_offset_; } 00033 uint64 last_event_offset() const { return last_event_offset_; } 00034 uint64 events() const { return events_; } 00035 uint64 run() const { return run_; } 00036 uint32 adler32() const { return (adlerb_ << 16) | adlera_; } 00037 00038 void set_do_adler(bool v) { do_adler_ = v; } 00039 void set_current_offset(uint64 v) { current_offset_ = v; } 00040 void set_first_event_offset(uint64 v) { first_event_offset_ = v; } 00041 void set_last_event_offset(uint64 v) { last_event_offset_ = v; } 00042 void set_events(uint64 v) { events_ = v; } 00043 void inc_events() { ++events_; } 00044 void set_run(uint64 v) { run_ = v; } 00045 00046 private: 00047 uint64 current_offset_; 00048 uint64 first_event_offset_; 00049 uint64 last_event_offset_; 00050 uint32 events_; 00051 uint32 run_; 00052 00053 bool do_adler_; 00054 uint32 adlera_; 00055 uint32 adlerb_; 00056 00057 boost::shared_ptr<std::ofstream> ost_; 00058 std::string filename_; 00059 }; 00060 00061 #endif