1 #ifndef UTIL_LCSplitWriter_H
2 #define UTIL_LCSplitWriter_H 1
4 #include "IO/LCWriter.h"
35 _lastCount(4294967295UL) {
59 virtual void open(
const std::string & filename,
int writeMode)
throw (
IO::IOException, std::exception ) ;
87 virtual void close() throw (IO::IOException, std::exception ) ;
94 virtual
void flush() throw (IO::IOException, std::exception ) ;
110 EVENT::long64
file_size( const
char *fname) ;
125 EVENT::long64 _maxBytes ;
126 std::
string _baseFilename ;
127 std::
string _filename ;
128 std::
string _extension ;
130 unsigned _lastCount ;
virtual void setCompressionLevel(int level)=0
Set the compression level - needs to be called before open() otherwise call will have no effect...
EVENT::long64 fileSize()
Return the current file size in bytes.
Definition: LCSplitWriter.cc:112
virtual void writeEvent(const EVENT::LCEvent *evt)
Writes the given file to file.
Definition: LCSplitWriter.cc:58
virtual void flush()
Flushes the output file/stream.
Definition: LCSplitWriter.cc:81
const std::string & getFilename()
Get the complete filename w/o extensiomn,e.g.
Definition: LCSplitWriter.cc:88
virtual void setCompressionLevel(int level)
Set CompressionLevel.
Definition: LCSplitWriter.h:71
long long long64
64 bit signed integer,e.g.to be used for timestamps
Definition: LCIOTypes.h:14
LCWriter wrapper that automatically splits files if a given number of bytes is exceeded.
Definition: LCSplitWriter.h:16
LCSplitWriter(IO::LCWriter *wrt, EVENT::long64 maxBytes)
The constructor.
Definition: LCSplitWriter.h:28
virtual ~LCSplitWriter()
Destructor.
Definition: LCSplitWriter.h:40
std::string getCountingString(unsigned count)
Returns the string representation of the file number, e.g.
Definition: LCSplitWriter.cc:146
EVENT::long64 file_size(const char *fname)
Helper function that returns the file size in bytes - o if the file does not exist.
Definition: LCSplitWriter.cc:100
IOException used for reading/writing errors.
Definition: Exceptions.h:92
virtual void writeRunHeader(const EVENT::LCRunHeader *hdr)
Writes the given run header to file.
Definition: LCSplitWriter.cc:46
void setBaseFilename(const std::string &filename)
Helper function to determine base file name, i.e.
Definition: LCSplitWriter.cc:127
The main event interface.
Definition: LCEvent.h:30
Interface for writing data with LCIO.
Definition: LCWriter.h:27
virtual void close()
Closes the output file/stream.
Definition: LCSplitWriter.cc:77
virtual void open(const std::string &filename)
Opens a file for writing where the filename has to include the extension but not the number...
Definition: LCSplitWriter.cc:31