rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTStreamGuardImp< StreamHandle, FilteredStreamImp > Class Template Reference
[Streams]

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

#include <rw/stream/RWTStreamGuardImp.h>

List of all members.

Public Member Functions

virtual ~RWTStreamGuardImp ()

Static Public Member Functions

static StreamHandle make (StreamHandle &stream)

Protected Member Functions

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

Friends

RWCharOutputStream rwGuard (RWCharOutputStream &stream)
RWByteOutputStream rwGuard (RWByteOutputStream &stream)
RWDataOutputStream rwGuard (RWDataOutputStream &stream)
RWUCharOutputStream rwGuard (RWUCharOutputStream &stream)
RWWCharOutputStream rwGuard (RWWCharOutputStream &stream)
RWCharInputStream rwGuard (RWCharInputStream &stream)
RWByteInputStream rwGuard (RWByteInputStream &stream)
RWDataInputStream rwGuard (RWDataInputStream &stream)
RWUCharInputStream rwGuard (RWUCharInputStream &stream)
RWWCharInputStream rwGuard (RWWCharInputStream &stream)

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

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.

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

Member Function Documentation

template<class StreamHandle , class FilteredStreamImp >
const StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream (  )  const [inline, protected]

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

template<class StreamHandle , class FilteredStreamImp >
StreamHandle & RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::getNextStream (  )  [inline, protected]

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

template<class StreamHandle , class FilteredStreamImp >
static StreamHandle RWTStreamGuardImp< StreamHandle, FilteredStreamImp >::make ( StreamHandle &  stream  )  [inline, static]

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.

Friends And Related Function Documentation

template<class StreamHandle , class FilteredStreamImp >
RWWCharInputStream rwGuard ( RWWCharInputStream stream  )  [friend]

Manipulator that is used to guard a series of extraction operations.

Parameters:
stream A wide character input stream.

Header File

 #include <rw/stream/RWGuardedWCharInputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

 // Lock the stream for the duration of all three insertions:
 instr >> rwGuard >> data1 >> data2 >> data3;
template<class StreamHandle , class FilteredStreamImp >
RWUCharInputStream rwGuard ( RWUCharInputStream stream  )  [friend]

Manipulator that is used to guard a series of extraction operations.

Parameters:
stream A UTF-16 character input stream.

Header File

 #include <rw/stream/RWGuardedUCharInputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 instr >> rwGuard >> data1 >> data2 >> data3;
template<class StreamHandle , class FilteredStreamImp >
RWDataInputStream rwGuard ( RWDataInputStream stream  )  [friend]

Manipulator that is used to guard a series of extraction operations.

Parameters:
stream A data input stream.

Header File

 #include <rw/stream/RWGuardedDataInputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 instr >> rwGuard >> data1 >> data2 >> data3;
template<class StreamHandle , class FilteredStreamImp >
RWByteInputStream rwGuard ( RWByteInputStream stream  )  [friend]

Manipulator that is used to guard a series of extraction operations.

Parameters:
stream A binary input stream.

Header File

 #include <rw/stream/RWGuardedByteInputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three extractions:
 instr >> rwGuard >> data1 >> data2 >> data3;
template<class StreamHandle , class FilteredStreamImp >
RWCharInputStream rwGuard ( RWCharInputStream stream  )  [friend]

Manipulator that is used to guard a series of extraction operations.

Parameters:
stream A narrow character input stream.

Header File

 #include <rw/stream/RWGuardedCharInputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 instr >> rwGuard >> data1 >> data2 >> data3;
template<class StreamHandle , class FilteredStreamImp >
RWWCharOutputStream rwGuard ( RWWCharOutputStream stream  )  [friend]

Manipulator that is used to guard a series of insertion operations.

Parameters:
stream A wide character output stream.

Header File

 #include <rw/stream/RWGuardedWCharOutputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

 // Lock the stream for the duration of all three insertions:
 ostr << rwGuard << data1 << data2 << data3;
template<class StreamHandle , class FilteredStreamImp >
RWUCharOutputStream rwGuard ( RWUCharOutputStream stream  )  [friend]

Manipulator that is used to guard a series of insertion operations.

Parameters:
stream A UTF-16 character output stream.

Header File

 #include <rw/stream/RWGuardedUCharOutputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

 // Lock the stream for the duration of all three insertions:
 ostr << rwGuard << data1 << data2 << data3;
template<class StreamHandle , class FilteredStreamImp >
RWDataOutputStream rwGuard ( RWDataOutputStream stream  )  [friend]

Manipulator that is used to guard a series of insertion operations.

Parameters:
stream A binary output stream.

Header File

 #include <rw/stream/RWGuardedDataOutputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 ostr << rwGuard << data1 << data2 << data3;
template<class StreamHandle , class FilteredStreamImp >
RWByteOutputStream rwGuard ( RWByteOutputStream stream  )  [friend]

Manipulator that is used to guard a series of insertion operations.

Parameters:
stream A binary output stream

Header File

 #include <rw/stream/RWGuardedByteOutputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 ostr << rwGuard << data1 << data2 << data3;
template<class StreamHandle , class FilteredStreamImp >
RWCharOutputStream rwGuard ( RWCharOutputStream stream  )  [friend]

Manipulator that is used to guard a series of insertion operations.

Parameters:
stream A narrow character output stream

Header File

 #include <rw/stream/RWGuardedCharOutputStreamImp.h>

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Examples

 // Lock the stream for the duration of all three insertions:
 ostr << rwGuard << data1 << data2 << data3;
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.