Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

UTIL::LCSplitWriter Class Reference

#include <LCSplitWriter.h>

Inheritance diagram for UTIL::LCSplitWriter:

IO::LCWriter IO::LCWriter List of all members.

Public Member Functions

 LCSplitWriter (IO::LCWriter *wrt, EVENT::long64 maxBytes)
virtual ~LCSplitWriter ()
virtual void open (const std::string &filename) throw (IO::IOException, std::exception )
virtual void open (const std::string &filename, int writeMode) throw (IO::IOException, std::exception )
virtual void writeRunHeader (const EVENT::LCRunHeader *hdr) throw (IO::IOException, std::exception )
virtual void writeEvent (const EVENT::LCEvent *evt) throw (IO::IOException, std::exception )
virtual void close () throw (IO::IOException, std::exception )
virtual void flush () throw (IO::IOException, std::exception )
EVENT::long64 fileSize ()
 LCSplitWriter (IO::LCWriter *wrt, EVENT::long64 maxBytes)
virtual ~LCSplitWriter ()
virtual void open (const std::string &filename) throw (IO::IOException, std::exception )
virtual void open (const std::string &filename, int writeMode) throw (IO::IOException, std::exception )
virtual void writeRunHeader (const EVENT::LCRunHeader *hdr) throw (IO::IOException, std::exception )
virtual void writeEvent (const EVENT::LCEvent *evt) throw (IO::IOException, std::exception )
virtual void close () throw (IO::IOException, std::exception )
virtual void flush () throw (IO::IOException, std::exception )
EVENT::long64 fileSize ()

Protected Member Functions

 LCSplitWriter ()
EVENT::long64 file_size (const char *fname)
const std::string & getFilename ()
void setBaseFilename (const std::string &filename)
std::string getCountingString (unsigned count)
 LCSplitWriter ()
EVENT::long64 file_size (const char *fname)
const std::string & getFilename ()
void setBaseFilename (const std::string &filename)
std::string getCountingString (unsigned count)

Protected Attributes

IO::LCWriter_wrt
EVENT::long64 _maxBytes
std::string _baseFilename
std::string _extension
unsigned _count
IO::LCWriter_wrt

Detailed Description

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 ...
Note: this is experimental beta code - please use for testing only !

Author:
gaede
Version:
Id
LCSplitWriter.h,v 1.1 2006/03/06 15:25:04 gaede Exp

Definition at line 18 of file LCSplitWriter.h.


Constructor & Destructor Documentation

UTIL::LCSplitWriter::LCSplitWriter IO::LCWriter wrt,
EVENT::long64  maxBytes
[inline]
 

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.

Definition at line 30 of file LCSplitWriter.h.

virtual UTIL::LCSplitWriter::~LCSplitWriter  )  [inline, virtual]
 

Destructor.

Definition at line 41 of file LCSplitWriter.h.

UTIL::LCSplitWriter::LCSplitWriter  )  [protected]
 

UTIL::LCSplitWriter::LCSplitWriter IO::LCWriter wrt,
EVENT::long64  maxBytes
[inline]
 

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.

Definition at line 30 of file LCSplitWriter.h.

virtual UTIL::LCSplitWriter::~LCSplitWriter  )  [inline, virtual]
 

Destructor.

Definition at line 41 of file LCSplitWriter.h.

UTIL::LCSplitWriter::LCSplitWriter  )  [protected]
 


Member Function Documentation

virtual void UTIL::LCSplitWriter::close  )  throw (IO::IOException, std::exception ) [virtual]
 

Closes the output file/stream.

Exceptions:
IO::IOException 

Implements IO::LCWriter.

void UTIL::LCSplitWriter::close  )  throw (IO::IOException, std::exception ) [virtual]
 

Closes the output file/stream.

Exceptions:
IO::IOException 

Implements IO::LCWriter.

Definition at line 77 of file LCSplitWriter.cc.

References _wrt, and IO::LCWriter::close().

EVENT::long64 UTIL::LCSplitWriter::file_size const char *  fname  )  [protected]
 

Helper function that returns the file size in bytes - o if the file does not exist

long64 UTIL::LCSplitWriter::file_size const char *  fname  )  [protected]
 

Helper function that returns the file size in bytes - o if the file does not exist

Definition at line 103 of file LCSplitWriter.cc.

References EVENT::long64, and STAT64.

Referenced by fileSize().

EVENT::long64 UTIL::LCSplitWriter::fileSize  ) 
 

Return the current file size in bytes.

long64 UTIL::LCSplitWriter::fileSize  ) 
 

Return the current file size in bytes.

Definition at line 115 of file LCSplitWriter.cc.

References file_size(), getFilename(), and EVENT::long64.

virtual void UTIL::LCSplitWriter::flush  )  throw (IO::IOException, std::exception ) [virtual]
 

Flushes the output file/stream.

Exceptions:
IO::IOException 

Implements IO::LCWriter.

void UTIL::LCSplitWriter::flush  )  throw (IO::IOException, std::exception ) [virtual]
 

Flushes the output file/stream.

Exceptions:
IO::IOException 

Implements IO::LCWriter.

Definition at line 81 of file LCSplitWriter.cc.

References _wrt, and IO::LCWriter::flush().

std::string UTIL::LCSplitWriter::getCountingString unsigned  count  )  [protected]
 

Returns the string representation of the file number, e.g. "007".

std::string UTIL::LCSplitWriter::getCountingString unsigned  count  )  [protected]
 

Returns the string representation of the file number, e.g. "007".

Definition at line 149 of file LCSplitWriter.cc.

References NDIGITS.

Referenced by getFilename().

const std::string& UTIL::LCSplitWriter::getFilename  )  [protected]
 

Get the complete filename w/o extensiomn,e.g. MyFilename.007

const std::string & UTIL::LCSplitWriter::getFilename  )  [protected]
 

Get the complete filename w/o extensiomn,e.g. MyFilename.007

Definition at line 88 of file LCSplitWriter.cc.

References _baseFilename, _count, _extension, and getCountingString().

Referenced by fileSize().

virtual 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:
IO::IOException 

Implements IO::LCWriter.

virtual 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:
IO::IOException 

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:
IO::IOException 

Implements IO::LCWriter.

Definition at line 37 of file LCSplitWriter.cc.

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:
IO::IOException 

Implements IO::LCWriter.

Definition at line 31 of file LCSplitWriter.cc.

void UTIL::LCSplitWriter::setBaseFilename const std::string &  filename  )  [protected]
 

Helper function to determine base file name, i.e. w/o extension.

void UTIL::LCSplitWriter::setBaseFilename const std::string &  filename  )  [protected]
 

Helper function to determine base file name, i.e. w/o extension.

Definition at line 130 of file LCSplitWriter.cc.

References _baseFilename, and _extension.

virtual void UTIL::LCSplitWriter::writeEvent const EVENT::LCEvent evt  )  throw (IO::IOException, std::exception ) [virtual]
 

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:
IO::IOException 

Implements IO::LCWriter.

void UTIL::LCSplitWriter::writeEvent const EVENT::LCEvent evt  )  throw (IO::IOException, std::exception ) [virtual]
 

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:
IO::IOException 

Implements IO::LCWriter.

Definition at line 58 of file LCSplitWriter.cc.

virtual void UTIL::LCSplitWriter::writeRunHeader const EVENT::LCRunHeader hdr  )  throw (IO::IOException, std::exception ) [virtual]
 

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:
IO::IOException 

Implements IO::LCWriter.

void UTIL::LCSplitWriter::writeRunHeader const EVENT::LCRunHeader hdr  )  throw (IO::IOException, std::exception ) [virtual]
 

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:
IO::IOException 

Implements IO::LCWriter.

Definition at line 46 of file LCSplitWriter.cc.


Member Data Documentation

std::string UTIL::LCSplitWriter::_baseFilename [protected]
 

Definition at line 120 of file LCSplitWriter.h.

Referenced by getFilename(), and setBaseFilename().

unsigned UTIL::LCSplitWriter::_count [protected]
 

Definition at line 122 of file LCSplitWriter.h.

Referenced by getFilename().

std::string UTIL::LCSplitWriter::_extension [protected]
 

Definition at line 121 of file LCSplitWriter.h.

Referenced by getFilename(), and setBaseFilename().

EVENT::long64 UTIL::LCSplitWriter::_maxBytes [protected]
 

Definition at line 119 of file LCSplitWriter.h.

IO::LCWriter* UTIL::LCSplitWriter::_wrt [protected]
 

Definition at line 118 of file LCSplitWriter.h.

IO::LCWriter* UTIL::LCSplitWriter::_wrt [protected]
 

Definition at line 118 of file LCSplitWriter.h.

Referenced by close(), and flush().


The documentation for this class was generated from the following files:
Generated on Sun Jun 3 06:32:40 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1