SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Implements a simple lock stream that can be used with any kind of input stream. More...
#include <rw/stream/RWTInputStreamLockImp.h>
Public Types | |
typedef InputStream | RWInputStream_type |
typedef InputStream::element_type | element_type |
Public Member Functions | |
virtual | ~RWTInputStreamLockImp () |
virtual void | close () |
virtual bool | isEof () const |
virtual bool | isBad () const |
virtual bool | isFail () const |
virtual bool | isGood () const |
virtual element_type | read () |
virtual RWSize | read (element_type *array, RWSize num) |
virtual RWSize | available () const |
virtual RWSize | skip (RWSize numUnits) |
virtual InputStream | acquire () |
virtual void | release () |
Static Public Member Functions | |
static InputStream | make (const InputStream &sourceStream) |
Protected Member Functions | |
RWTInputStreamLockImp (const InputStream &sourceStream) | |
RWMutexLock & | getStreamMutex () |
RWMutexLock & | getStreamMutex () const |
The class RWTInputStreamLockImp implements a simple lock stream that can be used with any kind of input stream. The stream locks its internal synchronization mechanism, before forwarding input requests to its associated source 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 that an exception is thrown.
typedef InputStream::element_type RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::element_type |
A typedef for the type of element to be read from RWInputStream_type.
typedef InputStream RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::RWInputStream_type |
A typedef for the template parameter InputStream
which will be used as the source of elements.
virtual RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::~RWTInputStreamLockImp | ( | ) | [virtual] |
Destructor.
RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::RWTInputStreamLockImp | ( | const InputStream & | sourceStream | ) | [protected] |
Initializes the reference to the input stream that will be used as the source of elements.
sourceStream | The input stream that will serve as the source of elements. |
virtual InputStream RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::acquire | ( | ) | [virtual] |
Acquires the stream's internal synchronization mechanism. The acquire() member function returns a handle to the next processing stream.
virtual RWSize RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::available | ( | ) | const [virtual] |
Returns the number of elements that can be read from the stream without blocking. Throws no exceptions.
virtual void RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::close | ( | ) | [virtual] |
Calls close on the next processing stream.
RWMutexLock & RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::getStreamMutex | ( | ) | const [inline, protected] |
These functions return the stream's internal synchronization mechanism. They throw no exceptions.
RWMutexLock & RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::getStreamMutex | ( | ) | [inline, protected] |
These functions return the stream's internal synchronization mechanism. They throw no exceptions.
virtual bool RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::isBad | ( | ) | const [virtual] |
If the stream is in bad state, then this function returns true
, otherwise it returns false
. Throws no exceptions.
virtual bool RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::isEof | ( | ) | const [virtual] |
If no data can be obtained from the input sequence, this function returns true
, otherwise it returns false
. Throws no exceptions.
virtual bool RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::isFail | ( | ) | const [virtual] |
If the stream is in fail state, then this function returns true
, otherwise it returns false
. Throws no exceptions.
virtual bool RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::isGood | ( | ) | const [virtual] |
If the stream is in fail or bad state, then this function returns false
, otherwise it returns true
. Throws no exceptions.
static InputStream RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::make | ( | const InputStream & | sourceStream | ) | [inline, static] |
Constructs an RWTInputStreamLockImp instance that uses sourceStream as its source of elements, and returns a handle to it. Throws no exceptions.
sourceStream | The output stream that will serve as the source of elements. |
Reimplemented in RWSynchronizedByteInputStreamImp, RWSynchronizedCharInputStreamImp, RWSynchronizedUCharInputStreamImp, and RWSynchronizedWCharInputStreamImp.
virtual RWSize RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::read | ( | element_type * | array, | |
RWSize | num | |||
) | [virtual] |
Reads an array of elements. The function returns the actual number of elements read.
array | A pointer to the first element of the array. The array must have been pre-allocated to contain at least num elements. | |
num | The number of elements to be read from the stream. |
virtual element_type RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::read | ( | ) | [virtual] |
Reads a single element.
virtual void RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::release | ( | ) | [virtual] |
Releases the stream's internal synchronization mechanism.
virtual RWSize RWTInputStreamLockImp< InputStream, FilteredInputStreamImp >::skip | ( | RWSize | numUnits | ) | [virtual] |
Skips numUnits elements from the input sequence if possible. The function returns the actual number of elements skipped, which can be any value between 0 and numUnits.
numUnits | The number of elements to be skipped. |
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.