Tools.h++ Manual
104011 Tandem Computers Incorporated 21-223
21
RWXDRistream
RWXDRistream
||
RWvistream RWios
|
RWvios
Synopsis
#include <rw/xdrstrea.h>
XDR xdr;
xdrstdio_create(&xdr, stdin, XDR_DECODE);
RWXDRistream rw_xdr(&xdr);
Description Class
RWXDRistream
is a portable input stream based on XDR routines. Class
RWXDRistream
encapsulates a portion of the XDR library routines that are
used for external data representation. XDR routines allow programmers to
describe arbitrary data structures in a machine-independent fashion. Data for
remote procedure calls (RPC) are transmitted using XDR routines.
Class
RWXDRistream
enables one to decode an XDR structure to a machine
representation. Class
RWXDRistream
provides the capability to decode all the
standard data types and vectors of those data types.
An XDR stream must first be created by calling the appropriate creation
routine. XDR streams currently exist for encoding/decoding of data to or from
standard I/O FILE streams, TCP/IP connections and Unix files, and memory.
These creation routines take arguments that are tailored to the specific
properties of the stream. After the XDR stream has been created, it can then be
used as the argument to the constructor for a
RWXDRistream
object.
RWXDRistream
can be interrogated as to the status of the stream using
member functions
bad()
,
clear()
,
eof()
,
fail()
,
good()
, and
rdstate()
.
Example The example that follows is a “reader” program that decodes an XDR structure
from a FILE stream. The example for class
RWXDRostream
is the “writer”
program that encodes the XDR structures onto the FILE stream.