VR-Link API Documentation for DIS
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:

List of all members.

Public Member Functions

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

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.

Private Member Functions

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

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 b,
int &  globalThresholdRef,
int  threshold = 1,
DtPrinter dflt_printer = 0 
)
virtual DtOutputStream::~DtOutputStream ( ) [virtual]

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) [inline, virtual]

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

int DtOutputStream::threshold ( ) const [inline, virtual]

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

virtual void DtOutputStream::write ( const std::string &  str) [virtual]

Writes the string to each printer.


Member Data Documentation

This is the global value we compare myThreshold to.

int DtOutputStream::myThreshold [protected]

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

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)