SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
RWSynchronizedDataOutputStreamImp Class Reference

Implementation of a simple lock stream that can be used with a data output stream. More...

#include <rw/stream/RWSynchronizedDataOutputStreamImp.h>

Inheritance diagram for RWSynchronizedDataOutputStreamImp:
RWFilteredDataOutputStreamImp RWDataOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual ~RWSynchronizedDataOutputStreamImp ()
 
virtual RWDataOutputStream acquire ()
 
virtual void close ()
 
virtual void flush ()
 
virtual bool isBad () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual void putBool (bool value)
 
virtual void putBools (const bool *arrayPt, RWSize count)
 
virtual void putChar (char value)
 
virtual void putCharacter (char value)
 
virtual void putChars (const char *arrayPt, RWSize count)
 
virtual void putDouble (double value)
 
virtual void putDoubles (const double *arrayPt, RWSize count)
 
virtual void putFloat (float value)
 
virtual void putFloats (const float *arrayPt, RWSize count)
 
virtual void putInt (int value)
 
virtual void putInts (const int *arrayPt, RWSize count)
 
virtual void putLong (long value)
 
virtual void putLongDouble (long double value)
 
virtual void putLongDoubles (const long double *arrayPt, RWSize count)
 
virtual void putLongLong (long long value)
 
virtual void putLongLongs (const long long *arrayPt, RWSize count)
 
virtual void putLongs (const long *arrayPt, RWSize count)
 
virtual void putShort (short value)
 
virtual void putShorts (const short *arrayPt, RWSize count)
 
virtual void putSignedChar (signed char value)
 
virtual void putSignedChars (const signed char *arrayPt, RWSize count)
 
virtual void putSizeT (size_t value)
 
virtual void putString (const char *string, RWSize count)
 
virtual void putUCharacter (RWUChar value)
 
virtual void putUnsignedChar (unsigned char value)
 
virtual void putUnsignedChars (const unsigned char *arrayPt, RWSize count)
 
virtual void putUnsignedInt (unsigned int value)
 
virtual void putUnsignedInts (const unsigned int *arrayPt, RWSize count)
 
virtual void putUnsignedLong (unsigned long value)
 
virtual void putUnsignedLongLong (unsigned long long value)
 
virtual void putUnsignedLongLongs (const unsigned long long *arrayPt, RWSize count)
 
virtual void putUnsignedLongs (const unsigned long *arrayPt, RWSize count)
 
virtual void putUnsignedShort (unsigned short value)
 
virtual void putUnsignedShorts (const unsigned short *arrayPt, RWSize count)
 
virtual void putUString (const RWUChar *ustring, RWSize count)
 
virtual void putWchar_t (wchar_t value)
 
virtual void putWchar_ts (const wchar_t *arrayPt, RWSize count)
 
virtual void putWCharacter (wchar_t value)
 
virtual void putWString (const wchar_t *wstring, RWSize count)
 
virtual void release ()
 
- Public Member Functions inherited from RWFilteredDataOutputStreamImp
virtual ~RWFilteredDataOutputStreamImp ()
 
- Public Member Functions inherited from RWDataOutputStreamImp
virtual ~RWDataOutputStreamImp ()
 
- Public Member Functions inherited from RWOutputStreamImp
virtual ~RWOutputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Static Public Member Functions

static RWDataOutputStream make (const RWDataOutputStream &sinkStream)
 

Protected Member Functions

 RWSynchronizedDataOutputStreamImp (const RWDataOutputStream &sinkStream)
 
RWMutexLockgetStreamMutex ()
 
RWMutexLockgetStreamMutex () const
 
- Protected Member Functions inherited from RWFilteredDataOutputStreamImp
 RWFilteredDataOutputStreamImp (const RWDataOutputStream &sinkStream)
 
RWDataOutputStreamgetSinkStream ()
 
const RWDataOutputStreamgetSinkStream () const
 
- Protected Member Functions inherited from RWDataOutputStreamImp
 RWDataOutputStreamImp ()
 
- Protected Member Functions inherited from RWOutputStreamImp
 RWOutputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

The class RWSynchronizedDataOutputStreamImp implements a simple lock stream that can be used with data output stream. The stream locks its internal synchronization mechanism before forwarding output requests to its associated sink stream, and then unlocks 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 an exception is thrown.

Constructor & Destructor Documentation

virtual RWSynchronizedDataOutputStreamImp::~RWSynchronizedDataOutputStreamImp ( )
virtual

Destructor.

RWSynchronizedDataOutputStreamImp::RWSynchronizedDataOutputStreamImp ( const RWDataOutputStream sinkStream)
protected

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

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

Member Function Documentation

virtual RWDataOutputStream RWSynchronizedDataOutputStreamImp::acquire ( )
virtual

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

Reimplemented from RWDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::close ( )
virtual

Forwards the close() request to the next processing stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::flush ( )
virtual

Forwards the flush() request to the next processing stream.

Reimplemented from RWFilteredDataOutputStreamImp.

RWMutexLock & RWSynchronizedDataOutputStreamImp::getStreamMutex ( )
inlineprotected

Returns the stream's internal synchronization mechanism. Throws no exceptions.

RWMutexLock & RWSynchronizedDataOutputStreamImp::getStreamMutex ( ) const
inlineprotected

Returns the stream's internal synchronization mechanism. Throws no exceptions.

virtual bool RWSynchronizedDataOutputStreamImp::isBad ( ) const
virtual

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

Reimplemented from RWFilteredDataOutputStreamImp.

virtual bool RWSynchronizedDataOutputStreamImp::isFail ( ) const
virtual

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

Reimplemented from RWFilteredDataOutputStreamImp.

virtual bool RWSynchronizedDataOutputStreamImp::isGood ( ) const
virtual

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

Reimplemented from RWFilteredDataOutputStreamImp.

static RWDataOutputStream RWSynchronizedDataOutputStreamImp::make ( const RWDataOutputStream sinkStream)
inlinestatic

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

Parameters
sinkStreamThe output stream that will serve as the sink of data.
virtual void RWSynchronizedDataOutputStreamImp::putBool ( bool  value)
virtual

Forward writing of a single bool value to the next processing stream.

Parameters
valueThe bool value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putBools ( const bool *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of bool values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putChar ( char  value)
virtual

Forward writing of a single char value to the next processing stream.

Parameters
valueThe char value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putCharacter ( char  value)
virtual

Forwards the writing of a single narrow character to the next processing stream.

Parameters
valueThe narrow character to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putChars ( const char *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of char values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putDouble ( double  value)
virtual

Forward writing of a single double value to the next processing stream.

Parameters
valueThe double value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putDoubles ( const double *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of double values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putFloat ( float  value)
virtual

Forward writing of a single float value to the next processing stream.

Parameters
valueThe float value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putFloats ( const float *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of float values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putInt ( int  value)
virtual

Forward writing of a single int value to the next processing stream.

Parameters
valueThe int value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putInts ( const int *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of int values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLong ( long  value)
virtual

Forward writing of a single long value to the next processing stream.

Parameters
valueThe long value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLongDouble ( long double  value)
virtual

Forward writing of a single long double value to the next processing stream.

Parameters
valueThe long double value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLongDoubles ( const long double *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of long double values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLongLong ( long long  value)
virtual

Forward writing of a single long long value to the next processing stream.

Parameters
valueThe long long value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLongLongs ( const long long *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of long long values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putLongs ( const long *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of long values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putShort ( short  value)
virtual

Forward writing of a single short value to the next processing stream.

Parameters
valueThe short value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putShorts ( const short *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of short values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putSignedChar ( signed char  value)
virtual

Forward writing of a single signed char value to the next processing stream.

Parameters
valueThe signed char value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putSignedChars ( const signed char *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of signed char values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putSizeT ( size_t  value)
virtual

Forwards the writing of a single size_t character to the next processing stream.

Parameters
valueThe size_t character to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putString ( const char *  string,
RWSize  count 
)
virtual

Forwards the writing of a narrow character string, including embedded nulls, starting at string to the next processing stream.

Parameters
stringA pointer to the narrow string's first character.
countThe number of narrow character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUCharacter ( RWUChar  value)
virtual

Forwards the writing of a single UTF-16 character to the next processing stream.

Parameters
valueThe unicode character to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedChar ( unsigned char  value)
virtual

Forward writing of a single unsigned char value to the next processing stream.

Parameters
valueThe unsigned char value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedChars ( const unsigned char *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of unsigned char values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedInt ( unsigned int  value)
virtual

Forward writing of a single unsigned int value to the next processing stream.

Parameters
valueThe unsigned int value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedInts ( const unsigned int *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of unsigned int values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedLong ( unsigned long  value)
virtual

Forward writing of a single unsigned long value to the next processing stream.

Parameters
valueThe unsigned long value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedLongLong ( unsigned long long  value)
virtual

Forward writing of a single unsigned long long value to the next processing stream.

Parameters
valueThe unsigned long long value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedLongLongs ( const unsigned long long *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of unsigned long long values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedLongs ( const unsigned long *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of unsigned long values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedShort ( unsigned short  value)
virtual

Forward writing of a single unsigned short value to the next processing stream.

Parameters
valueThe unsigned short value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUnsignedShorts ( const unsigned short *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of unsigned short values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putUString ( const RWUChar ustring,
RWSize  count 
)
virtual

Forwards the writing of a UTF-16 character string, including embedded nulls, starting at ustring to the next processing stream.

Parameters
ustringA pointer to the string's first unicode character.
countThe number of unicode character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putWchar_t ( wchar_t  value)
virtual

Forward writing of a single wchar_t value to the next processing stream.

Parameters
valueThe wchar_t value to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putWchar_ts ( const wchar_t *  arrayPt,
RWSize  count 
)
virtual

Forward writing of an array of wchar_t values to the next processing stream.

Parameters
arrayPtA pointer to the first element of the array.
countThe number of elements to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putWCharacter ( wchar_t  value)
virtual

Forward writing of a single wide character to the next processing stream.

Parameters
valueThe wide character to be written.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::putWString ( const wchar_t *  wstring,
RWSize  count 
)
virtual

Forwards the writing of a wide character string, including embedded nulls, starting at wstring to the next processing stream.

Parameters
wstringA pointer to the string's first wide character.
countThe number of wide character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

virtual void RWSynchronizedDataOutputStreamImp::release ( )
virtual

Releases the stream's internal synchronization mechanism.

Reimplemented from RWDataOutputStreamImp.

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