SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp > Class Template Reference

Implements a simple lock stream that can be used with any kind of output stream. More...

#include <rw/stream/RWTOutputStreamLockImp.h>

Inherits FilteredOutputStreamImp.

Public Types

typedef OutputStream::element_type element_type
 
typedef OutputStream RWOutputStream_type
 

Public Member Functions

virtual ~RWTOutputStreamLockImp ()
 
virtual OutputStream acquire ()
 
virtual void close ()
 
virtual void flush ()
 
virtual bool isBad () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual void release ()
 
virtual void write (element_type value)
 
virtual void write (const element_type *array, RWSize numElements)
 

Static Public Member Functions

static OutputStream make (const OutputStream &sinkStream)
 

Protected Member Functions

 RWTOutputStreamLockImp (const OutputStream &sinkStream)
 
RWMutexLockgetStreamMutex ()
 
RWMutexLockgetStreamMutex () const
 

Detailed Description

template<class OutputStream, class FilteredOutputStreamImp>
class RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >

The class RWTOutputStreamLockImp implements a simple lock stream that can be used with any kind of output stream. The stream locks its internal synchronization mechanism before forwarding output requests to its associated sink stream, and then unlock the internal synchronization mechanism upon completion. The stream's internal synchronization mechanism is locked using a guard object, ensuring its proper release in the event that an exception is thrown.

Member Typedef Documentation

template<class OutputStream , class FilteredOutputStreamImp >
typedef OutputStream::element_type RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::element_type

A typedef for the type of element to be written to RWOutputStream_type.

template<class OutputStream , class FilteredOutputStreamImp >
typedef OutputStream RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::RWOutputStream_type

A typedef for the template parameter OutputStream which will be used as the sink for elements.

Constructor & Destructor Documentation

template<class OutputStream , class FilteredOutputStreamImp >
virtual RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::~RWTOutputStreamLockImp ( )
virtual

Destructor.

template<class OutputStream , class FilteredOutputStreamImp >
RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::RWTOutputStreamLockImp ( const OutputStream &  sinkStream)
protected

Initializes the reference to the output stream that will be used as the sink of elements.

Parameters
sinkStreamThe output stream that will serve as the sink of elements.

Member Function Documentation

template<class OutputStream , class FilteredOutputStreamImp >
virtual OutputStream RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::acquire ( )
virtual

Acquires the stream's internal synchronization mechanism. The acquire() member function returns a handle to the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::close ( )
virtual

Calls close() on the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::flush ( )
virtual

Calls flush() on the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp >
RWMutexLock & RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::getStreamMutex ( )
inlineprotected

These functions return the stream's internal synchronization mechanism. They throw no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
RWMutexLock & RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::getStreamMutex ( ) const
inlineprotected

These functions return the stream's internal synchronization mechanism. They throw no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
virtual bool RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::isBad ( ) const
virtual

Returns true to indicate a loss of integrity resulting from an output operation. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
virtual bool RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::isFail ( ) const
virtual

Returns true to indicate that an output operation failed to generate the desired data. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
virtual bool RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::isGood ( ) const
virtual

Returns true to indicate a stream in a valid state. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
static OutputStream RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::make ( const OutputStream &  sinkStream)
inlinestatic

Constructs an RWTOutputStreamLockImp instance that uses sinkStream as its sink of elements, and returns a handle to it. Throws no exceptions.

Parameters
sinkStreamThe output stream that will serve as the sink of elements.
template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::release ( )
virtual

Releases the stream's internal synchronization mechanism.

template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::write ( element_type  value)
virtual

Writes a single element to the stream.

Parameters
valueThe element to be written to the stream.
template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamLockImp< OutputStream, FilteredOutputStreamImp >::write ( const element_type array,
RWSize  numElements 
)
virtual

Writes an array of elements to the stream.

Parameters
arrayA pointer to the first element of the array.
numElementsThe number of elements to be written to the stream.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.