LCIO  "2.7.4"
 All Classes Namespaces Functions Variables Typedefs Friends Pages
SIOWriter.h
1 #ifndef SIO_SIOWRITER_H
2 #define SIO_SIOWRITER_H 1
3 
4 #include <string>
5 #include <vector>
6 #include "IO/LCWriter.h"
7 #include "EVENT/LCEvent.h"
8 #include "EVENT/LCRunHeader.h"
9 
10 #include "LCIORandomAccessMgr.h"
11 
12 #include "SIO_block.h"
13 
14 class SIO_record ;
15 class SIO_stream ;
16 
17 
18 namespace SIO {
19 
20  class SIOEventHandler ;
21  class SIORunHeaderHandler ;
22  class SIOCollectionHandler ;
23 
24  class SIOReader ;
25  class SIOUnpack ;
26 
34  class SIOWriter : public IO::LCWriter {
35 
36 
37  friend class SIOReader ; // SIO Reader uses SAME SIO records !!
38  friend class SIOUnpack ;
39 
40  public:
41 
44  SIOWriter() ;
48  virtual ~SIOWriter() ;
49 
55  virtual void open(const std::string & filename) throw (IO::IOException, std::exception) ;
56 
63  virtual void open(const std::string & filename, int writeMode)throw (IO::IOException, std::exception) ;
64 
78  virtual void setCompressionLevel(int level) ;
79 
80 
85  virtual void writeRunHeader(const EVENT::LCRunHeader * hdr)throw (IO::IOException, std::exception) ;
86 
91  virtual void writeEvent(const EVENT::LCEvent * evt) throw (IO::IOException, std::exception) ;
92 
97  virtual void close() throw (IO::IOException, std::exception) ;
98 
103  virtual void flush() throw (IO::IOException, std::exception) ;
104 
105 
106  protected:
107 
110  void setUpHandlers(const EVENT::LCEvent * evt) ;
111 
115  void getSIOFileName(const std::string& filename,
116  std::string& sioFilename) ;
117 
118  protected:
119 
120  SIO_stream *_stream ;
121  int _compressionLevel ;
122 
123  private:
124 
125  SIOEventHandler *_hdrHandler ;
126  SIORunHeaderHandler *_runHandler ;
127  std::vector<SIO_block*> _connectedBlocks ;
128 
129  protected:
130 
131 // SIO_record *_evtRecord ;
132 // SIO_record *_hdrRecord ;
133 // SIO_record *_runRecord ;
134 
135  LCIORandomAccessMgr _raMgr ;
136 
137  }; // class
138 
139 } // namespace.
140 
141 #endif /* ifndef SIO_SIOWRITER_H */
void getSIOFileName(const std::string &filename, std::string &sioFilename)
Creates a proper filename with extension 'slcio' in sioFilename.
Definition: SIOWriter.cc:99
Manager class for LCIO direct access.
Definition: LCIORandomAccessMgr.h:38
SIOWriter()
Default constructor.
Definition: SIOWriter.cc:38
Interface for the run header.
Definition: LCRunHeader.h:23
virtual void close()
Closes the output file/stream etc.
Definition: SIOWriter.cc:319
Concrete implementation of LCWriter using SIO.
Definition: SIOWriter.h:34
virtual void flush()
Flushes the output file/stream etc.
Definition: SIOWriter.cc:337
virtual void writeRunHeader(const EVENT::LCRunHeader *hdr)
Writes the given run header to file.
Definition: SIOWriter.cc:187
virtual void setCompressionLevel(int level)
Set the compression level - needs to be called before open() otherwise call will have no effect...
Definition: SIOWriter.cc:182
virtual ~SIOWriter()
Destructor.
Definition: SIOWriter.cc:70
Handler for LCEvent/LCEventIOImpl objects.
Definition: SIOEventHandler.h:19
IOException used for reading/writing errors.
Definition: Exceptions.h:92
void setUpHandlers(const EVENT::LCEvent *evt)
Sets up the handlers for writing the current event.
Definition: SIOWriter.cc:225
Handler for LCRunHeader/LCRunHeaderImpl objects.
Definition: SIORunHeaderHandler.h:20
The main event interface.
Definition: LCEvent.h:30
Concrete implementation of LCWriter using SIO.
Definition: SIOReader.h:33
Interface for writing data with LCIO.
Definition: LCWriter.h:27
virtual void writeEvent(const EVENT::LCEvent *evt)
Writes the given event to file.
Definition: SIOWriter.cc:269
virtual void open(const std::string &filename)
Opens a file for writing.
Definition: SIOWriter.cc:80