RawWriter.hh
Go to the documentation of this file.00001
00007 #ifndef RAWWRITER_h
00008 #define RAWWRITER_h
00009
00010 #include <fstream>
00011 #include <string>
00012 #include "BaseModule.hh"
00013 #include "Reader.hh"
00014
00019 class RawWriter : public BaseModule{
00020 public:
00021 RawWriter();
00022 ~RawWriter();
00023
00024
00025 int Initialize();
00026 int Process(EventPtr event);
00027 int Finalize();
00028 static const std::string GetDefaultName(){ return "RawWriter"; }
00029
00031 const std::string& GetFilename(){
00032 if(_filename=="") _filename = GetDefaultFilename();
00033 return _filename;
00034 }
00036 int GetCompressionLevel(){ return _compression; }
00038 bool IsOK(){ return _ok; }
00040 long long GetBytesWritten(){ return _bytes_written; }
00042 std::string GetDefaultFilename() const;
00043 std::string GetFilename() const { return _filename; }
00044 void SetFilename(const std::string& name){ _filename = name; }
00045
00046 void SetSaveConfig(bool save) { _save_config = save; }
00047 bool GetSaveConfig(){ return _save_config; }
00048 private:
00050 void SaveConfigFile();
00051 int OpenNewFile();
00052 int CloseCurrentFile();
00053
00054 std::string _filename;
00055 std::string _directory;
00056 bool _create_directory;
00057 std::string _autonamebase;
00058 int _compression;
00059 bool _save_config;
00060 std::ofstream _fout;
00061 std::ofstream _logout;
00062 void* _log_messenger;
00063
00064 bool _ok;
00065 long long _bytes_written;
00066 uint32_t _max_file_size;
00067 int _max_event_in_file;
00068
00069 Reader::global_header _ghead;
00070 };
00071
00072 #endif