Rogue Wave Software logo banner

Click on the banner to return to the Class Reference home page.

©Copyright 1996 Rogue Wave Software

RWeistream


                                   ...inherits fromios
RWeistreaminherits fromRWbistream  ...
                                   ...inherits fromRWvistreaminherits fromRWvios

Synopsis

#include <rw/estream.h>
RWeistream estr(cin);           // Construct an RWeistream,                                // using cin's streambuf

Description

Class RWeistream specializes the base class RWbistream to restore values previously stored by RWeostream.

The endian streams, RWeistream and RWeostream, offer an efficient compromise between the portable streams (RWpistream, RWpostream) and the binary streams (RWbistream, RWbostream). By compensating for differences in big-endian vs. little-endian formats, as well as sizes of the various integral types, the endian streams offer portability without incurring the stream-size overhead of translating values into a series of printable characters. For example, data stored in little-endian format by an RWeostream object in a DOS program can be retrieved by an RWeistream object on any of several machines, regardless of its native endian format or the sizes of its integral types. Endian streams will work properly when shared among a group of platforms that:

As with the portable streams, care must be taken when storing or retrieving variables of type char. Endian stream methods treat chars as numbers except where the method description explicitly states that the char is being treated, instead, as a character. See the entry for RWpostream for an example of this distinction. Data stored in an integral type on one platform may be too large to fit into that type on a receiving platform. If so, the RWeistream's failbit will be set.

Endian streams can be interrogated as to the stream state using member functions good(), bad(), eof(), etc.

Persistence

None.

Example

See RWeostream for an example of how the file "data.dat" might be created.

Public Constructors

RWeistream(streambuf* s);
RWeistream(istream& str);

Public Member Functions

virtual int
get();
virtual RWvistream&
get(char& c);
virtual RWvistream&
get(unsigned char& c);
virtual RWvistream&
get(char* v, size_t N);
virtual RWvistream&
get(unsigned char* v, size_t N);
virtual RWvistream&
get(wchar_t& wc);
virtual RWvistream&
get(wchar_t* v, size_t N);
virtual RWvistream&
get(double* v, size_t N);
virtual RWvistream&
get(float* v, size_t N);
virtual RWvistream&
get(int* v, size_t N);
virtual RWvistream&
get(long* v, size_t N);
virtual RWvistream&
get(short* v, size_t N);
virtual RWvistream&
get(unsigned short* v, size_t N);
virtual RWvistream&
get(unsigned int* v, size_t N);
virtual RWvistream&
get(unsigned long* v, size_t N);
virtual RWvistream&
getString(char* s, size_t N);
virtual RWvistream&
operator>>(char& c);
virtual RWvistream&
operator>>(wchar_t& wc);
virtual RWvistream&
operator>>(double& d);
virtual RWvistream&
operator>>(float& f);
virtual RWvistream&
operator>>(int& i);
virtual RWvistream&
operator>>(long& l);
virtual RWvistream&
operator>>(short& s);
virtual RWvistream&
operator>>(unsigned char& c);
virtual RWvistream&
operator>>(unsigned short& s);
virtual RWvistream&
operator>>(unsigned int& i);
virtual RWvistream&
operator>>(unsigned long& l);
RWeostream::EndianstreamEndian();
size_t
streamSizeofInt();
size_t
streamSizeofLong();
size_t
streamSizeofShort();
size_t
streamSizeofSizeT();
size_t
streamSizeofWchar();