Module: Advanced Tools Package: Serialization
RWDataFromVirtualInputStreamImp RWDataInputStreamImp
#include <rw/serial/RWDataFromVirtualInputStreamImp.h>
An adapter class that allows an Essential Tools Module virtual input stream (RWvistream) to be used where a RWDataInputStream is required. Implements the body idiom from the handle-body pattern.
// 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); RWDataInputStream in = RWDataFromVirtualInputStreamImp::make(pstrm); int j; in >> j; cout << j; } return 0; }
RWDataFromVirtualInputStreamImp(RWvistream& vstrm);
Constructs an RWDataFromVirtualInputStreamImp instance that adapts the RW virtual output stream instance, vstrm to the RWDataInputStreamImp interface. Throws no exceptions.
Parameter List
vstrm |
The virtual input stream being adapted. |
static RWDataInputStream make(RWvistream& vstrm);
Returns an RWDataFromVirtualInputStreamImp instance that adapts the RW virtual output stream instance, vstrm to the RWDataInputStreamImp interface. Throws no exceptions.
Parameter List
vstrm |
The virtual input stream being adapted. |
virtual RWSize available() const;
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.
virtual RWSize getBools(bool* arrayPt, RWSize count);
Reads an array of bool values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getChars(char* arrayPt, RWSize count);
Reads an array of char values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getDelimitedString(char* arrayPt, RWSize count, char delim= '\0');
Reads a String value from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getDelimitedUString(RWUChar* arrayPt, RWSize count,
unsigned short delim);
Reads a UTF-16 string value from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getDelimitedWString(wchar_t* arrayPt, RWSize count,
wchar_t delim= L'\0');
Reads a wide string value from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getDoubles(double* arrayPt, RWSize count);
Reads an array of double values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getFloats(float* arrayPt, RWSize count);
Reads an array of float values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getInts(int* arrayPt, RWSize count);
Reads an array of int values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual RWSize getLongDoubles(long double* arrayPt, RWSize count);
Reads an array of long double values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getLongLongs(long long* arrayPt, RWSize count);
Reads an array of long long values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getLongs(long* arrayPt, RWSize count);
Reads an array of long values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getShorts(short* arrayPt, RWSize count);
Reads an array of short values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getSignedChars(signed char* arrayPt, RWSize count);
Reads an array of signed char values from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getString(char* arrayPt, RWSize count);
Reads a String value from the stream. The array must have been pre-allocated to contain at least count elements. Parameter arrayPt is a pointer to the array's first element. Parameter count is the number of elements to be read from the stream.
virtual RWSize getUString(RWUChar* arrayPt, RWSize count);
Reads a UTF-16 string value from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getUnsignedChars(unsigned char* arrayPt, RWSize count);
Reads an array of unsigned char values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getUnsignedInts(unsigned int* arrayPt, RWSize count);
Reads an array of unsigned int values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getUnsignedLongs(unsigned long* arrayPt, RWSize count);
Reads an array of unsigned long values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getUnsignedShorts(unsigned short* arrayPt, RWSize count);
Reads an array of unsigned short values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getWString(wchar_t* arrayPt, RWSize count);
Reads a wide string value from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize getWchar_ts(wchar_t* arrayPt, RWSize count);
Reads an array of wchar_t values from the stream. The array must have been pre-allocated to contain at least count elements.
Parameter List
arrayPt |
Pointer to the array's first element. |
count |
Number of elements to be read from the stream. |
virtual RWSize skip(RWSize numUnits);
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.
Parameter List
numUnits |
The number of elements to be skipped. |
virtual void close();
Close the stream.
virtual void getBool(bool& value);
Reads a bool value from the stream.
virtual void getCharacter(char& value);
Reads a TinyCharacter value from the stream.
virtual void getChar(char& value);
Reads a char value from the stream.
virtual void getDouble(double& value);
Reads a double value from the stream.
virtual void getFloat(float& value);
Reads a float value from the stream.
virtual void getInt(int& value);
Reads an int value from the stream.
virtual void getLongDouble(long double& value);
Reads a long double value from the stream.
virtual void getLongLong(long long& value);
Reads a long long value from the stream.
virtual void getLong(long& value);
Reads a long value from the stream.
virtual void getShort(short& value);
Reads a short value from the stream.
virtual void getSignedChar(signed char& value);
Reads a signed char value from the stream.
virtual void getUCharacter(RWUChar& value);
Reads a UTF-16Character value from the stream.
virtual void getUnsignedChar(unsigned char& value);
Reads an unsigned char value from the stream.
virtual void getUnsignedInt(unsigned int& value);
Reads an unsigned int value from the stream.
virtual void getUnsignedLong(unsigned long& value);
Reads an unsigned long value from the stream.
virtual void getUnsignedShort(unsigned short& value);
Reads an unsigned short value from the stream.
virtual void getWCharacter(wchar_t& value);
Reads a WideCharacter value from the stream.
virtual void getWchar_t(wchar_t& value);
Reads a wchar_t value from the stream.
virtual bool isEof() const;
Returns true to indicate that an input operation reached the end of an input sequence. Throws 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.