Module: Advanced Tools Package: Streams
RWSynchronizedDataInputStreamImp RWFilteredDataInputStreamImp RWDataInputStreamImp RWInputStreamImp RWStreamImp
#include <rw/stream/RWSynchronizedDataInputStreamImp.h>
Class RWSynchronizedDataInputStreamImp implements a simple lock stream that is used with data 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.
RWSynchronizedDataInputStreamImp(RWDataInputStream& sourceStream);
Initializes the reference to the input stream that will be used as the source of data.
Parameter List
sourceStream |
The input stream that will serve as the source of data. |
virtual ~RWSynchronizedDataInputStreamImp();
Destructor.
static RWDataInputStream make(RWDataInputStream& sourceStream);
Constructs an RWSynchronizedDataInputStreamImp instance that uses sourceStream as its source of data, and returns a handle to it. Throws no exceptions.
Parameter List
sourceStream |
The output stream that will serve as the source of data. |
virtual RWDataInputStream acquire();
Acquires the stream's internal synchronization mechanism. The acquire() member function returns a handle to the next processing stream.
virtual RWSize available() const;
Returns the number of bytes that can be read from the stream without blocking. Throws no exceptions.
virtual void close();
Calls close on the next processing stream.
virtual void getBool(bool& value); virtual void getCharacter(char& value); virtual void getChar(char& value); virtual void getDouble(double& value); virtual void getFloat(float& value); virtual void getInt(int& value); virtual void getLong(long& value); virtual void getLongDouble(long double& value); virtual void getLongLong(long long& value); virtual void getShort(short& value); virtual void getSignedChar(signed char& value); virtual void getUCharacter(RWUChar& value); virtual void getUnsignedChar(unsigned char& value); virtual void getUnsignedInt(unsigned int& value); virtual void getUnsignedLong(unsigned long& value); virtual void getUnsignedShort(unsigned short& value); virtual void getWCharacter(wchar_t& value); virtual void getWchar_t(wchar_t& value);
These functions forward the reading of a single value to the attached source stream.
Parameter List
value |
The value to be read from the attached source stream. |
virtual RWSize getBools(bool* arrayPt, RWSize count); virtual RWSize getChars(char* arrayPt, RWSize count); virtual RWSize getDoubles(double* arrayPt, RWSize count); virtual RWSize getFloats(float* arrayPt, RWSize count); virtual RWSize getInts(int* arrayPt, RWSize count); virtual RWSize getLongs(long* arrayPt, RWSize count); virtual RWSize getLongDoubles(long double* arrayPt, RWSize count); virtual RWSize getLongLongs(long long* arrayPt, RWSize count); virtual RWSize getShorts(short* arrayPt, RWSize count); virtual RWSize getSignedChars(signed char* arrayPt, RWSize count); virtual RWSize getUnsignedChars(unsigned char* arrayPt, RWSize count); virtual RWSize getUnsignedInts(unsigned int* arrayPt, RWSize count); virtual RWSize getUnsignedLongs(unsigned long* arrayPt, RWSize count); virtual RWSize getUnsignedShorts(unsigned short* arrayPt, RWSize count); virtual RWSize getWchar_ts(wchar_t* arrayPt, RWSize count);
These functions forward the reading an array of elements to the attached source stream. The function returns the number of elements read.
Parameter List
arrayPt |
A pointer to the first element of the array. The array must have been pre-allocated to contain at least count elements. |
count |
The number of elements to be read from the stream. |
virtual RWSize getDelimitedString(char* string, RWSize maxCount, char delim);
Forwards the reading of narrow characters from the stream until the last character read is equal to delim, or maxCount narrow characters have been read, or the end of the input sequence is reached. The narrow characters read are stored in string. The function returns the actual number of narrow characters read from the stream.
Parameter List
string |
A pointer to the string receiving the narrow characters extracted from the stream. |
maxCount |
The maximum number of narrow characters to be read. |
delim |
The narrow character used as a delimiter. |
virtual RWSize getDelimitedUString(RWUChar* ustring, RWSize maxCount,
RWUChar delim);
Forwards the reading of UTF-16 characters from the stream until the last character read is equal to delim, or maxCount UTF-16 characters have been read, or the end of the input sequence is reached. The UTF-16 characters read are stored in ustring. The function returns the actual number of UTF-16 characters read from the stream.
Parameter List
ustring |
A pointer to the string receiving the UTF-16 characters extracted from the stream. |
maxCount |
The maximum number of UTF-16 characters to be read. |
delim |
The UTF-16 character used as a delimiter. |
virtual RWSize getDelimitedWString(wchar_t* wstring, RWSize maxCount,
wchar_t delim);
Forwards the reading of wide characters from the stream until the last character read is equal to delim, or maxCount wide characters have been read, or the end of the input sequence is reached. The wide characters read are stored in wstring. The function returns the actual number of wide characters read from the stream.
Parameter List
wstring |
A pointer to the string receiving the wide characters extracted from the stream. |
maxCount |
The maximum number of wide characters to be read. |
delim |
The wide character used as a delimiter. |
virtual RWSize getString(char* string, RWSize count);
Forwards the reading of a string of narrow characters to the attached source stream. The function returns the number of narrow characters read.
Parameter List
string |
A pointer to the first element of the string. The string must have been pre-allocated to contain at least count narrow characters. |
count |
The number of narrow characters to be read from the stream. |
virtual RWSize getUString(RWUChar* ustring, RWSize count);
Forwards the reading of a string of UTF-16 characters to the attached source stream. The function returns the number of UTF-16 characters read.
Parameter List
ustring |
A pointer to the first element of the string. The string must have been pre-allocated to contain at least count UTF-16 characters. |
count |
The number of UTF-16 characters to be read from the stream. |
virtual RWSize getWString(wchar_t* wstring, RWSize count);
Forwards the reading of a string of wide characters to the attached source stream. The function returns the number of wide characters read.
Parameter List
wstring |
A pointer to the first element of the string. The string must have been pre-allocated to contain at least count wide characters. |
count |
The number of wide characters to be read from the stream. |
virtual bool isBad() const;
If the stream is in bad state, then this function returns true, otherwise it returns false. Throws no exceptions.
virtual bool isEof() const;
If no data can be obtained from the input sequence, this function returns true, otherwise it returns false. Throws no exceptions.
virtual bool isFail() const;
If the stream is in fail state, then this function returns true, otherwise it returns false. Throws no exceptions.
virtual bool isGood() const;
If the stream is in fail or bad state, then this function returns false, otherwise it returns true. Throws no exceptions.
virtual void release();
Releases the stream's internal synchronization mechanism.
virtual RWSize skip(RWSize numUnits);
Skips numUnits bytes from the input sequence if possible. The function returns the actual number of bytes skipped, which can be any value between 0 and numUnits.
Parameter List
numUnits |
The number of bytes to be skipped. |
RWMutexLock& getStreamMutex() const; RWMutexLock& getStreamMutex();
These functions return the stream's internal synchronization mechanism. They throw no exceptions.
© 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.