SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWSynchronizedCharInputStreamImp Class Reference

Implementation of a simple lock stream that is used with a narrow character input stream. More...

#include <rw/stream/RWSynchronizedCharInputStreamImp.h>

Inheritance diagram for RWSynchronizedCharInputStreamImp:
RWTInputStreamLockImp< RWCharInputStream, RWFilteredCharInputStreamImp > RWFilteredCharInputStreamImp RWCharInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual void readStringUntil (RWCString &string, char delim)
 
virtual RWSize readUntil (char *charArray, RWSize maxSize, char delim)
 
- Public Member Functions inherited from RWTInputStreamLockImp< RWCharInputStream, RWFilteredCharInputStreamImp >
virtual ~RWTInputStreamLockImp ()
 
virtual RWCharInputStream acquire (void)
 
virtual RWSize available (void) const
 
virtual void close (void)
 
virtual bool isBad (void) const
 
virtual bool isEof (void) const
 
virtual bool isFail (void) const
 
virtual bool isGood (void) const
 
virtual RWSize read (element_type *array, RWSize num)
 
virtual element_type read (void)
 
virtual void release (void)
 
virtual RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWFilteredCharInputStreamImp
virtual ~RWFilteredCharInputStreamImp ()
 
- Public Member Functions inherited from RWCharInputStreamImp
virtual ~RWCharInputStreamImp ()
 
- Public Member Functions inherited from RWInputStreamImp
virtual ~RWInputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Static Public Member Functions

static RWCharInputStream make (const RWCharInputStream &sourceStream)
 
- Static Public Member Functions inherited from RWTInputStreamLockImp< RWCharInputStream, RWFilteredCharInputStreamImp >
static RWCharInputStream make (const RWCharInputStream &sourceStream)
 

Protected Member Functions

 RWSynchronizedCharInputStreamImp (const RWCharInputStream &sourceStream)
 
- Protected Member Functions inherited from RWTInputStreamLockImp< RWCharInputStream, RWFilteredCharInputStreamImp >
 RWTInputStreamLockImp (const RWCharInputStream &sourceStream)
 
RWMutexLockgetStreamMutex (void)
 
RWMutexLockgetStreamMutex (void) const
 
- Protected Member Functions inherited from RWFilteredCharInputStreamImp
 RWFilteredCharInputStreamImp (const RWCharInputStream &sourceStream)
 
RWCharInputStreamgetSourceStream ()
 
const RWCharInputStreamgetSourceStream () const
 
- Protected Member Functions inherited from RWCharInputStreamImp
 RWCharInputStreamImp ()
 
- Protected Member Functions inherited from RWInputStreamImp
 RWInputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (const RWBodyBase &second)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (void)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (unsigned initCount=0)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (void)
 
 ~RWTMonitor (void)
 
void acquire (void)
 
bool isAcquired (void) const
 
RWTMonitor< RWMutexLock > & monitor (void) const
 
RWMutexLockmutex (void)
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release (void)
 
bool tryAcquire (void)
 

Additional Inherited Members

- Public Types inherited from RWTInputStreamLockImp< RWCharInputStream, RWFilteredCharInputStreamImp >
typedef RWCharInputStream::element_type element_type
 
typedef RWCharInputStream RWInputStream_type
 
- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

Class RWSynchronizedCharInputStreamImp implements a simple lock stream that is used with narrow character 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.

Constructor & Destructor Documentation

◆ RWSynchronizedCharInputStreamImp()

RWSynchronizedCharInputStreamImp::RWSynchronizedCharInputStreamImp ( const RWCharInputStream & sourceStream)
protected

Initializes the reference to the input stream that will be used as the source of narrow characters.

Parameters
sourceStreamThe input stream that will serve as the source of narrow characters.

Member Function Documentation

◆ make()

static RWCharInputStream RWSynchronizedCharInputStreamImp::make ( const RWCharInputStream & sourceStream)
inlinestatic

Constructs an RWSynchronizedCharInputStreamImp instance that uses sourceStream as its source of narrow characters, and returns a handle to it. Throws no exceptions.

Parameters
sourceStreamThe output stream that will serve as the source of narrow characters.

◆ readStringUntil()

virtual void RWSynchronizedCharInputStreamImp::readStringUntil ( RWCString & string,
char delim )
virtual

Reads narrow character(s) from the attached source stream until the last character read is equal to delim, or the end of the input sequence is reached. The narrow character(s) read are stored in a narrow string object.

Parameters
stringA string object receiving the narrow character(s) extracted from the stream.
delimThe narrow character used as a delimiter.

Reimplemented from RWFilteredCharInputStreamImp.

◆ readUntil()

virtual RWSize RWSynchronizedCharInputStreamImp::readUntil ( char * charArray,
RWSize maxSize,
char delim )
virtual

Reads narrow character(s) from the attached source stream until the last narrow character read is equal to delim, or maxSize narrow character(s) have been read, or the end of the input sequence is reached. The narrow character(s) read are stored in charArray. The function returns the actual number of narrow character(s) read from the stream.

Parameters
charArrayA pointer to the array receiving the narrow character(s) extracted from the stream.
maxSizeThe maximum number of narrow character(s) to be read.
delimThe narrow character value used as a delimiter.

Reimplemented from RWFilteredCharInputStreamImp.

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