SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWTStreamGuardImp< StreamHandle, FilteredStreamImp > Class Template Reference

A simple guard stream that can be used with any kind of input/output stream. More...

#include <rw/stream/RWTStreamGuardImp.h>

Inherits FilteredStreamImp.

Public Member Functions

virtual ~RWTStreamGuardImp ()
 

Static Public Member Functions

static StreamHandle make (StreamHandle &stream)
 

Protected Member Functions

 RWTStreamGuardImp (StreamHandle &stream)
 
StreamHandle & getNextStream (void)
 
const StreamHandle & getNextStream (void) const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~RWTStreamGuardImp()

template<class StreamHandle , class FilteredStreamImp >
virtual RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::~RWTStreamGuardImp ( )
virtual

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.

◆ RWTStreamGuardImp()

template<class StreamHandle , class FilteredStreamImp >
RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::RWTStreamGuardImp ( StreamHandle & stream)
protected

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
streamThe stream that will serve as the source/sink of elements.

Member Function Documentation

◆ getNextStream() [1/2]

template<class StreamHandle , class FilteredStreamImp >
StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream ( void )
inlineprotected

Returns a handle to the next processing stream. Throw no exceptions.

◆ getNextStream() [2/2]

template<class StreamHandle , class FilteredStreamImp >
const StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream ( void ) const
inlineprotected

Returns a handle to the next processing stream. Throw no exceptions.

◆ make()

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
streamThe stream that will serve as the source/sink of elements.

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