LCWriter wrapper that automatically splits files if a given number of bytes is exceeded.
More...
#include <UTIL/LCSplitWriter.h>
|
|
EVENT::long64 | file_size (const char *fname) |
| | Helper function that returns the file size in bytes - o if the file does not exist.
|
| |
| const std::string & | getFilename () |
| | Get the complete filename w/o extensiomn,e.g. More...
|
| |
| void | setBaseFilename (const std::string &filename) |
| | Helper function to determine base file name, i.e. More...
|
| |
| std::string | getCountingString (unsigned count) |
| | Returns the string representation of the file number, e.g. More...
|
| |
|
|
IO::LCWriter * | _wrt |
| |
|
EVENT::long64 | _maxBytes |
| |
|
std::string | _baseFilename |
| |
|
std::string | _filename |
| |
|
std::string | _extension |
| |
|
unsigned | _count |
| |
|
unsigned | _lastCount |
| |
LCWriter wrapper that automatically splits files if a given number of bytes is exceeded.
File names are extended by a file number of the form .000 - .999 ...
- Author
- gaede
- Version
- Id:
- LCSplitWriter.h,v 1.2 2007-11-09 21:00:55 gaede Exp
The constructor.
Takes a pointer to a valid LCWriter instance and the file size in bytes that causes a new file to be opened if exceeded. example:
// replace LCWriter* lcWrt = LCFactory::getInstance()->createLCWriter() ; // with LCSplitWriter* lcWrt = new LCSplitWriter( LCFactory::getInstance()->createLCWriter() , 2040109465 ) ;
to automatically split files after 1.9 GByte file size has been exceeded.
| void UTIL::LCSplitWriter::close |
( |
| ) |
|
| throw | ( | IO::IOException, |
| | std::exception |
| ) | | |
|
virtual |
Closes the output file/stream.
- Exceptions
-
Implements IO::LCWriter.
| void UTIL::LCSplitWriter::flush |
( |
| ) |
|
| throw | ( | IO::IOException, |
| | std::exception |
| ) | | |
|
virtual |
Flushes the output file/stream.
- Exceptions
-
Implements IO::LCWriter.
| std::string UTIL::LCSplitWriter::getCountingString |
( |
unsigned |
count | ) |
|
|
protected |
Returns the string representation of the file number, e.g.
"007".
| const std::string & UTIL::LCSplitWriter::getFilename |
( |
| ) |
|
|
protected |
Get the complete filename w/o extensiomn,e.g.
MyFilename.007
| void UTIL::LCSplitWriter::open |
( |
const std::string & |
filename | ) |
|
| throw | ( | IO::IOException, |
| | std::exception |
| ) | | |
|
virtual |
Opens a file for writing where the filename has to include the extension but not the number, e.g.
myfile.slcio. Note that this is different from the LCWriter specification.
- Exceptions
-
Implements IO::LCWriter.
| void UTIL::LCSplitWriter::open |
( |
const std::string & |
filename, |
|
|
int |
writeMode |
|
) |
| |
| throw | ( | IO::IOException, |
| | std::exception |
| ) | | |
|
virtual |
Not implemented - will throw an Exception if called.
Overwriting of or appending to split files is not straight forward. Pleas use the default write mode and remove exisiting files.
- Exceptions
-
Implements IO::LCWriter.
| void UTIL::LCSplitWriter::setBaseFilename |
( |
const std::string & |
filename | ) |
|
|
protected |
Helper function to determine base file name, i.e.
w/o extension.
| virtual void UTIL::LCSplitWriter::setCompressionLevel |
( |
int |
level | ) |
|
|
inlinevirtual |
Writes the given file to file.
Opens a new file if the given file size is already exceeded before the execution of the write access.
- Exceptions
-
Implements IO::LCWriter.
Writes the given run header to file.
Opens a new file if the given file size is already exceeded before the execution of the write access.
- Exceptions
-
Implements IO::LCWriter.
The documentation for this class was generated from the following files: