00001 #ifndef SIO_SIOWRITER_H
00002 #define SIO_SIOWRITER_H 1
00003
00004 #include <string>
00005 #include <vector>
00006 #include "IO/LCWriter.h"
00007 #include "EVENT/LCEvent.h"
00008 #include "EVENT/LCRunHeader.h"
00009
00010 #include "LCIORandomAccessMgr.h"
00011
00012 #include "SIO_block.h"
00013
00014 class SIO_record ;
00015 class SIO_stream ;
00016
00017
00018 namespace SIO {
00019
00020 class SIOEventHandler ;
00021 class SIORunHeaderHandler ;
00022 class SIOCollectionHandler ;
00023
00024 class SIOReader ;
00025 class SIOUnpack ;
00026
00034 class SIOWriter : public IO::LCWriter {
00035
00036
00037 friend class SIOReader ;
00038 friend class SIOUnpack ;
00039
00040 public:
00041
00044 SIOWriter() ;
00045
00047 SIOWriter(const SIOWriter&) = delete ;
00049 SIOWriter& operator=(const SIOWriter&) = delete ;
00050
00054 virtual ~SIOWriter() ;
00055
00061 virtual void open(const std::string & filename) ;
00062
00069 virtual void open(const std::string & filename, int writeMode) ;
00070
00084 virtual void setCompressionLevel(int level) ;
00085
00086
00091 virtual void writeRunHeader(const EVENT::LCRunHeader * hdr) ;
00092
00097 virtual void writeEvent(const EVENT::LCEvent * evt) ;
00098
00103 virtual void close() ;
00104
00109 virtual void flush() ;
00110
00111
00112 protected:
00113
00116 void setUpHandlers(const EVENT::LCEvent * evt) ;
00117
00121 void getSIOFileName(const std::string& filename,
00122 std::string& sioFilename) ;
00123
00124 protected:
00125
00126 SIO_stream *_stream ;
00127 int _compressionLevel ;
00128
00129 private:
00130
00131 SIOEventHandler *_hdrHandler ;
00132 SIORunHeaderHandler *_runHandler ;
00133 std::vector<SIO_block*> _connectedBlocks{} ;
00134
00135 protected:
00136
00137 LCIORandomAccessMgr _raMgr{} ;
00138
00139 };
00140
00141 }
00142
00143 #endif