Tools.h++ Manual
104011 Tandem Computers Incorporated 21-201
21
RWvostream
RWvostream
|
RWv ios
Synopsis
#include <rw/vstream.h>
Description Class
RWvostream
is an abstract base class. It provides an interface for
format-independent storage of primitives and arrays of primitives. Its
counterpart,
RWvistream
, provides a complementary interface for the
retrieval of these variables.
Because the interface of
RWvistream
and
RWvostream
is independent of
formatting, the user of these classes need not be concerned with how variables
will actually be stored or restored. That will be up to the derived class to
decide. It might be done using an operating-system independent ASCII format
(classes
RWpistream
and
RWpostream
), a binary format (classes
RWbistream
and
RWbostream
), or the user could define his or her own format (e.g., an
interface to a network).
Note – Because it is an abstract base class, there is no way to actually enforce
these goals—the description here is merely the model of how a class derived
from
RWvistream
and
RWvostream
should act.
Note – There is no need to separate variables with whitespace. It is the
responsibility of the derived class to delineate variables with whitespace,
packet breaks, or whatever might be appropriate for the final output sink.
The model is one where variables are inserted into the output stream, either
individually or as homogeneous vectors, to be restored in the same order using
RWvistream
.
Storage and retrieval of characters requires some explanation. Characters can
be thought of as either representing some alphanumeric or control character, or
as the literal number. Generally, the overloaded lshift (<<) and rshift (>>)
operators seek to store and restore characters preserving their symbolic
meaning. I.e., storage of a newline should be restored as a newline, regardless