SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
RWDataFromVirtualInputStreamImp Class Reference

Adapter class that allows virtual input stream class RWvistream to be used where data input stream class RWDataInputStream is required. More...

#include <rw/serial/RWDataFromVirtualInputStreamImp.h>

Inheritance diagram for RWDataFromVirtualInputStreamImp:
RWDataInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual RWSize available () const
 
virtual void close ()
 
virtual void getBool (bool &value)
 
virtual RWSize getBools (bool *arrayPt, RWSize count)
 
virtual void getChar (char &value)
 
virtual void getCharacter (char &value)
 
virtual RWSize getChars (char *arrayPt, RWSize count)
 
virtual RWSize getDelimitedString (char *arrayPt, RWSize count, char delim= '\0')
 
virtual RWSize getDelimitedUString (RWUChar *arrayPt, RWSize count, unsigned short delim)
 
virtual RWSize getDelimitedWString (wchar_t *arrayPt, RWSize count, wchar_t delim=L'\0')
 
virtual void getDouble (double &value)
 
virtual RWSize getDoubles (double *arrayPt, RWSize count)
 
virtual void getFloat (float &value)
 
virtual RWSize getFloats (float *arrayPt, RWSize count)
 
virtual void getInt (int &value)
 
virtual RWSize getInts (int *arrayPt, RWSize count)
 
virtual void getLong (long &value)
 
virtual void getLongDouble (long double &value)
 
virtual RWSize getLongDoubles (long double *arrayPt, RWSize count)
 
virtual void getLongLong (long long &value)
 
virtual RWSize getLongLongs (long long *arrayPt, RWSize count)
 
virtual RWSize getLongs (long *arrayPt, RWSize count)
 
virtual void getShort (short &value)
 
virtual RWSize getShorts (short *arrayPt, RWSize count)
 
virtual void getSignedChar (signed char &value)
 
virtual RWSize getSignedChars (signed char *arrayPt, RWSize count)
 
virtual void getSizeT (size_t &value)
 
virtual RWSize getString (char *arrayPt, RWSize count)
 
virtual void getUCharacter (RWUChar &value)
 
virtual void getUnsignedChar (unsigned char &value)
 
virtual RWSize getUnsignedChars (unsigned char *arrayPt, RWSize count)
 
virtual void getUnsignedInt (unsigned int &value)
 
virtual RWSize getUnsignedInts (unsigned int *arrayPt, RWSize count)
 
virtual void getUnsignedLong (unsigned long &value)
 
virtual void getUnsignedLongLong (unsigned long long &value)
 
virtual RWSize getUnsignedLongLongs (unsigned long long *arrayPt, RWSize count)
 
virtual RWSize getUnsignedLongs (unsigned long *arrayPt, RWSize count)
 
virtual void getUnsignedShort (unsigned short &value)
 
virtual RWSize getUnsignedShorts (unsigned short *arrayPt, RWSize count)
 
virtual RWSize getUString (RWUChar *arrayPt, RWSize count)
 
virtual void getWchar_t (wchar_t &value)
 
virtual RWSize getWchar_ts (wchar_t *arrayPt, RWSize count)
 
virtual void getWCharacter (wchar_t &value)
 
virtual RWSize getWString (wchar_t *arrayPt, RWSize count)
 
virtual bool isBad () const
 
virtual bool isEof () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWDataInputStreamImp
virtual ~RWDataInputStreamImp ()
 
- Public Member Functions inherited from RWInputStreamImp
virtual ~RWInputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Static Public Member Functions

static RWDataInputStream make (RWvistream &vstrm)
 

Protected Member Functions

 RWDataFromVirtualInputStreamImp (RWvistream &vstrm)
 
- Protected Member Functions inherited from RWDataInputStreamImp
 RWDataInputStreamImp ()
 
- Protected Member Functions inherited from RWInputStreamImp
 RWInputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
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 ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Additional Inherited Members

- 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

An adapter class that allows an Essential Tools Module virtual input stream (RWvistream) to be used where an RWDataInputStream is required. Implements the body idiom from the handle-body pattern.

Example
// Read data in using virtual streams.
#include <rw/serial/RWDataFromVirtualInputStreamImp.h>
#include <rw/pstream.h>
#include <iostream.h>
#include <fstream.h>
int main() {
ifstream ifstrm;
ifstrm.open("RWDataToVirtualOutputStreamImp.out",
ios::in | ios::nocreate);
if (!ifstrm) {
cout << "The input file does not exist."<< endl;
}
else {
RWpistream pstrm(ifstrm);
int j;
in >> j;
cout << j;
}
return 0;
}

Constructor & Destructor Documentation

RWDataFromVirtualInputStreamImp::RWDataFromVirtualInputStreamImp ( RWvistream vstrm)
inlineprotected

Constructs an RWDataFromVirtualInputStreamImp instance that adapts the RW virtual input stream instance vstrm to the RWDataInputStreamImp interface. Throws no exceptions.

Parameters
vstrmThe virtual input stream being adapted.

Member Function Documentation

virtual RWSize RWDataFromVirtualInputStreamImp::available ( ) const
inlinevirtual

Returns the number of available elements that can be read from the stream without blocking. The type of the elements read is specified by derived classes and can be one of the following: RWByte, char, RWUChar, or wchar_t. Throws no exceptions.

Implements RWInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::close ( void  )
inlinevirtual

Closes the stream.

Implements RWStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getBool ( bool &  value)
inlinevirtual

Reads a bool value from the stream.

Parameters
valueThe bool value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getBools ( bool *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of bool values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getChar ( char &  value)
inlinevirtual

Reads a char value from the stream.

Parameters
valueThe char value to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getCharacter ( char &  value)
inlinevirtual

Reads a TinyCharacter value from the stream.

Parameters
valueThe TinyCharacter value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getChars ( char *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of char values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getDelimitedString ( char *  arrayPt,
RWSize  count,
char  delim = '\0' 
)
inlinevirtual

Reads a String value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
delimThe narrow character used as a delimiter.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getDelimitedUString ( RWUChar arrayPt,
RWSize  count,
unsigned short  delim 
)
inlinevirtual

Reads a UTF-16 string value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
delimThe UTF-16 character used as a delimiter.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getDelimitedWString ( wchar_t *  arrayPt,
RWSize  count,
wchar_t  delim = L'\0' 
)
inlinevirtual

Reads a wide string value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
delimThe wide character used as a delimiter.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getDouble ( double &  value)
inlinevirtual

Reads a double value from the stream.

Parameters
valueThe double value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getDoubles ( double *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of double values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getFloat ( float &  value)
inlinevirtual

Reads a float value from the stream.

Parameters
valueThe float value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getFloats ( float *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of float values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getInt ( int &  value)
inlinevirtual

Reads an int value from the stream.

Parameters
valueThe int value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getInts ( int *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of int values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getLong ( long &  value)
inlinevirtual

Reads a long value from the stream.

Parameters
valueThe long value to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getLongDouble ( long double &  value)
inlinevirtual

Reads a long double value from the stream.

Parameters
valueThe long double value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getLongDoubles ( long double *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of long double values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getLongLong ( long long &  value)
inlinevirtual

Reads a long long value from the stream.

Parameters
valueThe long long value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getLongLongs ( long long *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of long long values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getLongs ( long *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of long values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getShort ( short &  value)
inlinevirtual

Reads a short value from the stream.

Parameters
valueThe short value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getShorts ( short *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of short values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getSignedChar ( signed char &  value)
inlinevirtual

Reads a signed char value from the stream.

Parameters
valueThe signed char value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getSignedChars ( signed char *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of signed char values from the stream. The array must have been pre-allocated to contain at least count elements. Returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getSizeT ( size_t &  value)
inlinevirtual

Reads a size_t value from the stream.

Parameters
valueThe size_t value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getString ( char *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads a String value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUCharacter ( RWUChar value)
inlinevirtual

Reads a UTF-16 Character value from the stream.

Parameters
valueThe UnicodeCharacter value to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUnsignedChar ( unsigned char &  value)
inlinevirtual

Reads an unsigned char value from the stream.

Parameters
valueThe unsigned char value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUnsignedChars ( unsigned char *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of unsigned char values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUnsignedInt ( unsigned int &  value)
inlinevirtual

Reads an unsigned int value from the stream.

Parameters
valueThe unsigned int value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUnsignedInts ( unsigned int *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of unsigned int values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUnsignedLong ( unsigned long &  value)
inlinevirtual

Reads an unsigned long value from the stream.

Parameters
valueThe unsigned long value to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUnsignedLongLong ( unsigned long long &  value)
inlinevirtual

Reads a unsigned long long value from the stream.

Parameters
valueThe unsigned long long value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUnsignedLongLongs ( unsigned long long *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of unsigned long long value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The functions return the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of elements to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUnsignedLongs ( unsigned long *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of unsigned long values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getUnsignedShort ( unsigned short &  value)
inlinevirtual

Reads an unsigned short value from the stream.

Parameters
valueThe unsigned short value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUnsignedShorts ( unsigned short *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of unsigned short values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getUString ( RWUChar arrayPt,
RWSize  count 
)
inlinevirtual

Reads a UTF-16 string value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getWchar_t ( wchar_t &  value)
inlinevirtual

Reads a wchar_t value from the stream.

Parameters
valueThe wchar_t value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getWchar_ts ( wchar_t *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads an array of wchar_t values from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual void RWDataFromVirtualInputStreamImp::getWCharacter ( wchar_t &  value)
inlinevirtual

Reads a WideCharacter value from the stream.

Parameters
valueThe WideCharacter value to be read from the stream.

Implements RWDataInputStreamImp.

virtual RWSize RWDataFromVirtualInputStreamImp::getWString ( wchar_t *  arrayPt,
RWSize  count 
)
inlinevirtual

Reads a wide string value from the stream. The array must have been pre-allocated to contain at least count elements.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.

Implements RWDataInputStreamImp.

virtual bool RWDataFromVirtualInputStreamImp::isBad ( ) const
inlinevirtual

Returns true to indicate a loss of integrity resulting from an input or output operation, such as an irrecoverable read error from a file. Throws no exceptions.

Implements RWStreamImp.

virtual bool RWDataFromVirtualInputStreamImp::isEof ( ) const
inlinevirtual

Returns true to indicate that an input operation reached the end of an input sequence. Throws no exceptions.

Implements RWInputStreamImp.

virtual bool RWDataFromVirtualInputStreamImp::isFail ( ) const
inlinevirtual

Returns true to indicate that an input operation failed to read the expected data, or that an output operation failed to generate the desired data. Throws no exceptions.

Implements RWStreamImp.

virtual bool RWDataFromVirtualInputStreamImp::isGood ( ) const
inlinevirtual

Returns true to indicate a stream in a valid state. Throws no exceptions.

Implements RWStreamImp.

static RWDataInputStream RWDataFromVirtualInputStreamImp::make ( RWvistream vstrm)
inlinestatic

Returns an RWDataFromVirtualInputStreamImp instance that adapts the RW virtual input stream instance vstrm to the RWDataInputStreamImp interface. Throws no exceptions.

Parameters
vstrmThe virtual input stream being adapted.
virtual RWSize RWDataFromVirtualInputStreamImp::skip ( RWSize  numUnits)
inlinevirtual

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. The type of the elements skipped is specified by derived classes and can be one of the following: RWByte, char, RWUChar, or wchar_t.

Parameters
numUnitsThe number of elements to be skipped.

Implements RWInputStreamImp.

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