Implements a simple lock stream that can be used with any kind of input stream. More...
#include <rw/stream/RWTInputStreamLockImp.h>
Inherits FilteredInputStreamImp.
Public Types | |
typedef InputStream::element_type | element_type |
typedef InputStream | RWInputStream_type |
Public Member Functions | |
virtual | ~RWTInputStreamLockImp () |
virtual InputStream | acquire () |
virtual RWSize | available () const |
virtual void | close () |
virtual bool | isBad () const |
virtual bool | isEof () const |
virtual bool | isFail () const |
virtual bool | isGood () const |
virtual element_type | read () |
virtual RWSize | read (element_type *array, RWSize num) |
virtual void | release () |
virtual RWSize | skip (RWSize numUnits) |
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 |
Destructor.
|
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 |
Acquires the stream's internal synchronization mechanism. The acquire() member function returns a handle to the next processing stream.
|
virtual |
Returns the number of elements that can be read from the stream without blocking. Throws no exceptions.
|
virtual |
Calls close on the next processing stream.
|
inlineprotected |
These functions return the stream's internal synchronization mechanism. They throw no exceptions.
|
inlineprotected |
These functions return the stream's internal synchronization mechanism. They throw no exceptions.
|
virtual |
If the stream is in bad state, then this function returns true
, otherwise it returns false
. Throws no exceptions.
|
virtual |
If no data can be obtained from the input sequence, this function returns true
, otherwise it returns false
. Throws no exceptions.
|
virtual |
If the stream is in fail state, then this function returns true
, otherwise it returns false
. Throws no exceptions.
|
virtual |
If the stream is in fail or bad state, then this function returns false
, otherwise it returns true
. Throws no exceptions.
|
inlinestatic |
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. |
|
virtual |
Reads a single element.
|
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 |
Releases the stream's internal synchronization mechanism.
|
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 © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |