Instruction Manual

Click on the banner to return to the user guide home page.
©Copyright 1996 Rogue Wave Software
Chapter 6: Using Virtual Streams
Specializing Virtual Streams
Simple Example
Windows Clipboard and DDE Streambufs
DDE Example
RWAuditStreamBuffer
Recap
The iostream facility that comes with every C++ compiler is a resource that should be familiar
to you as a C++ developer. Among its advantages are type-safe insertion and extraction into and
out of streams, extensibility to new types, and transparency to the user of the source and sink of
the stream bytes, which are set by the class streambuf.
But the iostream facility suffers from a number of limitations. Formatting abilities are
particularly weak; for example, if you insert a double into an ostream, there is no type-safe way
to insert it as binary. Furthermore, not all byte sources and sinks fit into the streambuf model.
For many protocols, such as XDR, the format is intrinsically wedded to the byte stream and
cannot be separated.
The Rogue Wave virtual streams facility overcomes these limitations by offering an idealized
model of a stream. No assumptions are made about formatting, or stream models. At the root of
the virtual streams class hierarchy is class RWvios. This is an abstract base class with an
interface similar to the standard library class ios:
class RWvios{
public:
virtual int eof() = 0;
virtual int fail() = 0;
virtual int bad() = 0;
virtual int good() = 0;
virtual int rdstate() = 0;
virtual int clear(int v = 0) = 0;
};
Classes derived from RWvios will define these functions.