LCIO
02.17
|
Concrete implementation of LCWriter using SIO. More...
#include <SIOWriter.h>
Public Member Functions | |
SIOWriter ()=default | |
Default constructor. More... | |
SIOWriter (const SIOWriter &)=delete | |
no copy constructor More... | |
SIOWriter & | operator= (const SIOWriter &)=delete |
no assignment operator More... | |
~SIOWriter ()=default | |
Destructor. More... | |
virtual void | open (const std::string &filename) |
Opens a file for writing. More... | |
virtual void | open (const std::string &filename, int writeMode) |
Opens a file for writing. More... | |
virtual void | setCompressionLevel (int level) |
Set the compression level - needs to be called before open() otherwise call will have no effect. More... | |
virtual void | writeRunHeader (const EVENT::LCRunHeader *hdr) |
Writes the given run header to file. More... | |
virtual void | writeEvent (const EVENT::LCEvent *evt) |
Writes the given event to file. More... | |
virtual void | close () |
Closes the output file/stream etc. More... | |
virtual void | flush () |
Flushes the output file/stream etc. More... | |
![]() | |
virtual | ~LCWriter () |
Destructor. More... | |
Private Member Functions | |
void | getSIOFileName (const std::string &filename, std::string &sioFilename) |
Creates a proper filename with extension 'slcio' in sioFilename. More... | |
Private Attributes | |
sio::ofstream | _stream {} |
The output file stream. More... | |
sio::buffer | _rawBuffer {2*sio::mbyte} |
The raw buffer for writing bytes to the stream. More... | |
sio::buffer | _compBuffer {sio::mbyte} |
The raw buffer for compression. More... | |
sio::zlib_compression | _compressor {} |
The compression in use. More... | |
SIOHandlerMgr | _eventHandlerMgr {} |
The collection block handler manager for events. More... | |
LCIORandomAccessMgr | _raMgr {} |
The random access manager. More... | |
Concrete implementation of LCWriter using SIO.
Use LCFactory to instantiate.
Definition at line 29 of file SIOWriter.h.
|
default |
Default constructor.
|
delete |
no copy constructor
|
default |
Destructor.
|
virtual |
Closes the output file/stream etc.
IOException |
Implements IO::LCWriter.
Definition at line 159 of file SIOWriter.cc.
References _raMgr, _stream, SIO::LCIORandomAccessMgr::clear(), and SIO::LCIORandomAccessMgr::writeRandomAccessRecords().
|
virtual |
Flushes the output file/stream etc.
IOException |
Implements IO::LCWriter.
Definition at line 167 of file SIOWriter.cc.
References _stream.
|
private |
Creates a proper filename with extension 'slcio' in sioFilename.
Definition at line 39 of file SIOWriter.cc.
References SIO::LCSIO::FileExtension, std::string::length(), and std::string::rfind().
Referenced by open().
|
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.
Definition at line 20 of file SIOWriter.cc.
References std::string::c_str(), and getSIOFileName().
|
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.
Definition at line 51 of file SIOWriter.cc.
References _raMgr, _stream, std::string::c_str(), getSIOFileName(), SIO::LCIORandomAccessMgr::initAppend(), SIO::LCSIO::RandomAccessSize, and std::stringstream::str().
|
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.
Definition at line 99 of file SIOWriter.cc.
References _compressor.
Referenced by IOIMPL::LCFactory::createLCWriter().
|
virtual |
Writes the given event to file.
IOException |
Implements IO::LCWriter.
Definition at line 125 of file SIOWriter.cc.
References _compBuffer, _compressor, _eventHandlerMgr, _raMgr, _rawBuffer, _stream, SIO::LCIORandomAccessMgr::add(), EVENT::LCEvent::getEventNumber(), EVENT::LCEvent::getRunNumber(), SIO::SIOEventHeaderRecord::writeRecord(), and SIO::SIOEventRecord::writeRecord().
|
virtual |
Writes the given run header to file.
IOException |
Implements IO::LCWriter.
Definition at line 105 of file SIOWriter.cc.
References _compBuffer, _compressor, _raMgr, _rawBuffer, _stream, SIO::LCIORandomAccessMgr::add(), EVENT::LCRunHeader::getRunNumber(), and SIO::SIORunHeaderRecord::writeRecord().
|
private |
The raw buffer for compression.
Definition at line 108 of file SIOWriter.h.
Referenced by writeEvent(), and writeRunHeader().
|
private |
The compression in use.
Definition at line 110 of file SIOWriter.h.
Referenced by setCompressionLevel(), writeEvent(), and writeRunHeader().
|
private |
The collection block handler manager for events.
Definition at line 112 of file SIOWriter.h.
Referenced by writeEvent().
|
private |
The random access manager.
Definition at line 114 of file SIOWriter.h.
Referenced by close(), open(), writeEvent(), and writeRunHeader().
|
private |
The raw buffer for writing bytes to the stream.
Definition at line 106 of file SIOWriter.h.
Referenced by writeEvent(), and writeRunHeader().
|
private |
The output file stream.
Definition at line 104 of file SIOWriter.h.
Referenced by close(), flush(), open(), writeEvent(), and writeRunHeader().