VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtFilePrinter Class Reference

DtFilePrinter is a subclass of DtPrinter which opens a file and dumps all information received from DtOutputStream to the file. More...

+ Inheritance diagram for DtFilePrinter:
+ Collaboration diagram for DtFilePrinter:

Public Member Functions

 DtFilePrinter ()
 Default CTOR.
 DtFilePrinter (const char *filename)
 CTOR.
virtual ~DtFilePrinter ()
 Virtual DTOR.
virtual void setPrintTimestamps (bool doit)
 Set whether timestamps should be printed.
virtual void setLogRollingInterval (unsigned int intervalInSeconds)
 Set the interval over which the logs should be rolled to a new file.
virtual void resetFile (const char *filename)
 Reset file will close the existing file, if there is one, and open a new file stream.
virtual bool isOpen ()
 returns if the file was successfully opened
virtual void write (const std::string &st, int notify_level, bool newLine)
 Writes the latest data to the file.
- Public Member Functions inherited from DtPrinter
 DtPrinter ()
 Default CTOR.
 DtPrinter (const DtPrinter &)
 Copy CTOR.
virtual ~DtPrinter ()
 Virtual DTOR.

Protected Member Functions

virtual void cacheFilename (const std::string &filename)
 Caches the filename and stores as base and extension.

Protected Attributes

DtMutex myFileLock
bool myTimestampFlag
time_t myLogFileOpenTime
unsigned int myLogRollingIndex
unsigned int myLogRollingInterval
std::string myFilename
std::string myFileBase
std::string myFileExt
std::ofstream myFile

Private Member Functions

 DtFilePrinter (const DtFilePrinter &orig)
 Copy CTOR - not implemented.
DtFilePrinteroperator= (const DtFilePrinter &orig)
 Assignment operator - not implemented.

Detailed Description

DtFilePrinter is a subclass of DtPrinter which opens a file and dumps all information received from DtOutputStream to the file.

If the file does not open for whatever reason no error is reported and all input is lost.

Constructor & Destructor Documentation

DtFilePrinter::DtFilePrinter ( )

Default CTOR.

Does not open a file; user must call resetFile to open a new file.

DtFilePrinter::DtFilePrinter ( const char *  filename)

CTOR.

Opens output file with the given name.

virtual DtFilePrinter::~DtFilePrinter ( )
virtual

Virtual DTOR.

Closes a file, so anything which is buffered will be written at this time.

DtFilePrinter::DtFilePrinter ( const DtFilePrinter orig)
private

Copy CTOR - not implemented.

Member Function Documentation

virtual void DtFilePrinter::cacheFilename ( const std::string &  filename)
protectedvirtual

Caches the filename and stores as base and extension.

virtual bool DtFilePrinter::isOpen ( )
virtual

returns if the file was successfully opened

DtFilePrinter& DtFilePrinter::operator= ( const DtFilePrinter orig)
private

Assignment operator - not implemented.

virtual void DtFilePrinter::resetFile ( const char *  filename)
virtual

Reset file will close the existing file, if there is one, and open a new file stream.

virtual void DtFilePrinter::setLogRollingInterval ( unsigned int  intervalInSeconds)
virtual

Set the interval over which the logs should be rolled to a new file.

Once the interval has elapsed, the file is closed, moved to a new file, then reopened before logging continues. An interval of zero disables rolling.

virtual void DtFilePrinter::setPrintTimestamps ( bool  doit)
virtual

Set whether timestamps should be printed.

virtual void DtFilePrinter::write ( const std::string &  st,
int  notify_level,
bool  newLine 
)
virtual

Writes the latest data to the file.

This method uses the newLine argument to prepend timestamps.

Implements DtPrinter.

Member Data Documentation

std::ofstream DtFilePrinter::myFile
protected
std::string DtFilePrinter::myFileBase
protected
std::string DtFilePrinter::myFileExt
protected
DtMutex DtFilePrinter::myFileLock
protected
std::string DtFilePrinter::myFilename
protected
time_t DtFilePrinter::myLogFileOpenTime
protected
unsigned int DtFilePrinter::myLogRollingIndex
protected
unsigned int DtFilePrinter::myLogRollingInterval
protected
bool DtFilePrinter::myTimestampFlag
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Mar 1 02:56:17 EST 2016 from SVN revision 162687
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)