A simple guard stream that can be used with any kind of input/output stream.
More...
#include <rw/stream/RWTStreamGuardImp.h>
Inherits FilteredStreamImp.
|
static StreamHandle | make (StreamHandle &stream) |
|
template<class StreamHandle, class FilteredStreamImp>
class RWTStreamGuardImp< StreamHandle, FilteredStreamImp >
The class RWTStreamGuardImp implements a simple guard stream that can be used with any kind of input/output stream. The stream guard acquires the synchronization mechanism provided by its source/sink stream at construction time, and releases it upon destruction. The guard stream doesn't maintain its own synchronization mechanism, but rather uses the one provided by the next processing stream. If the next processing stream doesn't implement any synchronization mechanism, then the stream guard class has no effect. The guard class is generally used in combination with one of the synchronization classes RWSynchronizedByteInputStreamImp, RWSynchronizedByteOutputStreamImp, RWSynchronizedCharInputStreamImp, RWSynchronizedCharOutputStreamImp, RWSynchronizedDataInputStreamImp, RWSynchronizedDataOutputStreamImp, RWSynchronizedUCharInputStreamImp, RWSynchronizedUCharOutputStreamImp, RWSynchronizedWCharInputStreamImp, or RWSynchronizedWCharOutputStreamImp.
template<class StreamHandle , class FilteredStreamImp >
Destructor. Releases the lock acquired in the guard stream constructor. If the next processing stream doesn't provide a synchronization mechanism, then the destructor has no effect. Throws no exceptions.
template<class StreamHandle , class FilteredStreamImp >
Initializes the reference to the stream that will be used as source/sink of elements. Acquires the synchronization mechanism provided by stream if any.
- Parameters
-
stream | The stream that will serve as the source/sink of elements. |
template<class StreamHandle , class FilteredStreamImp >
StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream |
( |
| ) |
|
|
inlineprotected |
Returns a handle to the next processing stream. Throw no exceptions.
template<class StreamHandle , class FilteredStreamImp >
const StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream |
( |
| ) |
const |
|
inlineprotected |
Returns a handle to the next processing stream. Throw no exceptions.
template<class StreamHandle , class FilteredStreamImp >
static StreamHandle RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::make |
( |
StreamHandle & |
stream | ) |
|
|
inlinestatic |
Constructs an RWTStreamGuardImp instance that uses stream as its source/sink of elements, and returns a handle to it. Throws no exceptions.
- Parameters
-
stream | The stream that will serve as the source/sink of elements. |