Concrete implementation of LCWriter using SIO. More...
#include <SIO/SIOWriter.h>
Public Member Functions | |
SIOWriter () | |
Default constructor. | |
SIOWriter (const SIOWriter &) | |
no copy constructor | |
SIOWriter & | operator= (const SIOWriter &) |
no assignment operator | |
virtual | ~SIOWriter () |
Destructor. | |
virtual void | open (const std::string &filename) |
Opens a file for writing. | |
virtual void | open (const std::string &filename, int writeMode) |
Opens a file for writing. | |
virtual void | setCompressionLevel (int level) |
Set the compression level - needs to be called before open() otherwise call will have no effect. | |
virtual void | writeRunHeader (const EVENT::LCRunHeader *hdr) |
Writes the given run header to file. | |
virtual void | writeEvent (const EVENT::LCEvent *evt) |
Writes the given event to file. | |
virtual void | close () |
Closes the output file/stream etc. | |
virtual void | flush () |
Flushes the output file/stream etc. | |
Protected Member Functions | |
void | setUpHandlers (const EVENT::LCEvent *evt) |
Sets up the handlers for writing the current event. | |
void | getSIOFileName (const std::string &filename, std::string &sioFilename) |
Creates a proper filename with extension 'slcio' in sioFilename. | |
Protected Attributes | |
SIO_stream * | _stream |
int | _compressionLevel |
Friends | |
class | SIOReader |
class | SIOUnpack |
Concrete implementation of LCWriter using SIO.
Use LCFactory to instantiate.
void SIO::SIOWriter::close | ( | ) | [virtual] |
void SIO::SIOWriter::flush | ( | ) | [virtual] |
void SIO::SIOWriter::open | ( | const std::string & | filename, | |
int | writeMode | |||
) | [virtual] |
Opens a file for writing.
Possible write modes are: LCIO::WRITE_NEW (existing files are replaced) and LCIO::WRITE_APPEND.
IOException |
Implements IO::LCWriter.
References getSIOFileName(), SIO::LCSIO::getValidSIOName(), and SIO::LCSIO::seekStream().
void SIO::SIOWriter::open | ( | const std::string & | filename | ) | [virtual] |
Opens a file for writing.
If file with given name exists, an exception is thrown. Use append or new mode instead.
IOException |
Implements IO::LCWriter.
References getSIOFileName().
void SIO::SIOWriter::setCompressionLevel | ( | int | level | ) | [virtual] |
Set the compression level - needs to be called before open() otherwise call will have no effect.
If not called the Writer will use default compression.
Valid compression levels are:
Experimental code - don't use for production.
level | compression level |
Implements IO::LCWriter.
void SIO::SIOWriter::setUpHandlers | ( | const EVENT::LCEvent * | evt | ) | [protected] |
Sets up the handlers for writing the current event.
Creates Handlers needed for writing the event on this stream.
Needs to be called for every event.
References EVENT::LCEvent::getCollection(), EVENT::LCEvent::getCollectionNames(), EVENT::LCCollection::getTypeName(), and EVENT::LCCollection::isTransient().
Referenced by writeEvent().
void SIO::SIOWriter::writeEvent | ( | const EVENT::LCEvent * | evt | ) | [virtual] |
Writes the given event to file.
IOException |
Implements IO::LCWriter.
References EVENT::LCEvent::getEventNumber(), EVENT::LCEvent::getRunNumber(), and setUpHandlers().
void SIO::SIOWriter::writeRunHeader | ( | const EVENT::LCRunHeader * | hdr | ) | [virtual] |
Writes the given run header to file.
IOException |
Implements IO::LCWriter.
References EVENT::LCRunHeader::getRunNumber().