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

DtOutputStream is used for all toolkit output. More...

+ Inheritance diagram for DtOutputStream:
+ Collaboration diagram for DtOutputStream:

Public Member Functions

 DtOutputStream (DtOutputStreamBuffer *buffer, int &globalThresholdRef, int threshold=1, DtPrinter *dflt_printer=0)
 CTOR. More...
 
virtual ~DtOutputStream ()
 Virtual DTOR. More...
 
virtual void attachPrinter (DtPrinter *sink)
 Add or remove DtPrinters from this Stream. More...
 
virtual bool detachPrinter (DtPrinter *sink)
 Returns true if printer was found, returns false if not found or other error. More...
 
virtual void detachAllPrinters ()
 Removes all DtPrinter references. More...
 
virtual void write (const std::string &str, bool newLine=false)
 Writes the string to each printer. More...
 
virtual void setThreshold (int level)
 Sets the threshold required for sending string output to all attached printer. More...
 
virtual int threshold () const
 Returns the current threshold required to send string output to all attached printers. More...
 
virtual bool okToPrint () const
 Boolean, if true we will write this, if false write is a no-op. More...
 
virtual void operator() (const char *s,...)
 Provided to allow printf like syntax. More...
 

Protected Types

typedef std::vector< DtPrinter * > PrinterPtrVec
 

Protected Attributes

DtOutputStreamBuffermyStreamBuf
 
DtMutex myStreamBufMutex
 
PrinterPtrVec myPrinters
 
DtMutex myPrintersMutex
 
int myThreshold
 
int & myGlobalThresholdReference
 This is the global value we compare myThreshold to. More...
 

Private Member Functions

 DtOutputStream (const DtOutputStream &)
 Copy constructor - not implemented. More...
 
DtOutputStreamoperator= (const DtOutputStream &)
 Assignment Operator - not implemented. More...
 

Detailed Description

DtOutputStream is used for all toolkit output.

It takes streams and strings of characters and sends them to one or more DtPrinter objects. Each DtPrinter object will then send that stream to an output device. It is possible for DtOutputStream to have NO DtPrinters, then it will output nothing.

DtOutputStream has a threshold property, based on this property the output stream will, or will not be sent to each registered printer. By default the threshold is compared to the global variable globalThresholdRef. If the value of globalThresholdRef is greater or equal to the value the threshold, the string is passed to each registered printer.

DtOutputStream maintains pointers to DtPrinter instances, when you attach a printer to it, you must maintain the DtPrinter instance for the whole time it is attached. Likewise DtOutputStream will not free this printer when you detach from it.

Member Typedef Documentation

typedef std::vector<DtPrinter*> DtOutputStream::PrinterPtrVec
protected

Constructor & Destructor Documentation

DtOutputStream::DtOutputStream ( DtOutputStreamBuffer buffer,
int &  globalThresholdRef,
int  threshold = 1,
DtPrinter dflt_printer = 0 
)

CTOR.

Takes a pointer to a variable to use to check against a global threshold. Each DtOutputStreamBuffer needs to also have a unique DtOutputStreamBuffer which should be created before the DtOutputStream that uses it is created.

virtual DtOutputStream::~DtOutputStream ( )
virtual

Virtual DTOR.

DtOutputStream::DtOutputStream ( const DtOutputStream )
private

Copy constructor - not implemented.

Member Function Documentation

virtual void DtOutputStream::attachPrinter ( DtPrinter sink)
virtual

Add or remove DtPrinters from this Stream.

virtual void DtOutputStream::detachAllPrinters ( )
virtual

Removes all DtPrinter references.

Remember, DtOutputStream does not manage any memory, so if you allocated a printer please delete it.

virtual bool DtOutputStream::detachPrinter ( DtPrinter sink)
virtual

Returns true if printer was found, returns false if not found or other error.

virtual bool DtOutputStream::okToPrint ( ) const
virtual

Boolean, if true we will write this, if false write is a no-op.

override this if you want to change the conditions under which this class will print.

virtual void DtOutputStream::operator() ( const char *  s,
  ... 
)
virtual

Provided to allow printf like syntax.

DtOutputStream& DtOutputStream::operator= ( const DtOutputStream )
private

Assignment Operator - not implemented.

void DtOutputStream::setThreshold ( int  level)
inlinevirtual

Sets the threshold required for sending string output to all attached printer.

int DtOutputStream::threshold ( ) const
inlinevirtual

Returns the current threshold required to send string output to all attached printers.

virtual void DtOutputStream::write ( const std::string &  str,
bool  newLine = false 
)
virtual

Writes the string to each printer.

The newLine argument indicates that the string to write starts a new line. This can be used to format output (eg. for adding timestamps).

Member Data Documentation

int& DtOutputStream::myGlobalThresholdReference
protected

This is the global value we compare myThreshold to.

PrinterPtrVec DtOutputStream::myPrinters
protected
DtMutex DtOutputStream::myPrintersMutex
protected
DtOutputStreamBuffer* DtOutputStream::myStreamBuf
protected
DtMutex DtOutputStream::myStreamBufMutex
protected
int DtOutputStream::myThreshold
protected

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

Document ID: Generated on Tue Feb 2 21:02:17 EST 2021 from SVN revision 223668
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)