Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWXDRostream (Unix only)

Module:  Essential Tools Module   Group:  Virtual Stream Classes


RWvostreamRWvios RWXDRostream RWios

Local Index

Members

Synopsis

#include <rw/xdrstrea.h>
XDR xdr;
xdrstdio_create(&xdr, stdout, XDR_ENCODE) ;
RWXDRostream rw_xdr(&xdr);

Description

Class RWXDRostream is a portable output stream based on XDR routines. Class RWXDRostream 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 RWXDRostream enables one to output from a stream and encode an XDR structure from a machine representation. Class RWXDRostream provides the capability to encode 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 iostreams and 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 an argument to the constructor for a RWXDRostream object.

RWXDRostream can be interrogated as to the status of the stream using member functions bad(), clear(), eof(), fail(), good(), and rdstate().

Persistence

None

Example

The example that follows is a "writer" program that encodes an XDR structure onto a file stream. The example for class RWXDRistream is the "reader" program that decodes the XDR structures into a machine representation for a data type. The library that supports XDR routines must be linked in. The name of this library is not standard.

Program output:

The output is written to the file "test".

Public Constructor

RWXDRostream(XDR* xp);
RWXDRostream(streambuf*);
RWXDRostream(ostream&);

Public Destructor

virtual ~RWXDRostream();

Public Member Functions

virtual RWvostream&
operator<<(const char* s); 
virtual RWvostream&
operator<<(char c);
virtual RWvostream&
operator<<(wchar_t wc);
virtual RWvostream&
operator<<(unsigned char c); 
virtual RWvostream&
operator<<(double d);
virtual RWvostream&
operator<<(float f);
virtual RWvostream&
operator<<(int i);
virtual RWvostream&
operator<<(unsigned int i);
virtual RWvostream&
operator<<(long l);
virtual RWvostream&
operator<<(unsigned long l);
virtual RWvostream&
operator<<(short s);
virtual RWvostream&
operator<<(unsigned short s);
virtual RWvostream&
put(char c); 
virtual RWvostream&
put(unsigned char c);
virtual RWvostream&
put(wchar_t wc);
virtual RWvostream&
put(const char* p, size_t N);
virtual RWvostream&
put(const wchar_t* p, size_t N);
virtual RWvostream&
put(const short* p, size_t N);
virtual RWvostream&
put(const unsigned short* p, size_t N);
virtual RWvostream&
put(const int* p, size_t N); 
virtual RWvostream&
put(const unsigned int* p, size_t N);
virtual RWvostream&
put(const long* p, size_t N);
virtual RWvostream&
put(const unsigned long* p, size_t N);
virtual RWvostream&
put(const float* p, size_t N);
virtual RWvostream&
put(const double* p, size_t N);
Virtual RWXDRostream&
flush();
Virtual RWXDRostream&
putString(const char*s, size_t N); 


Previous fileTop of DocumentContentsIndex pageNext file

© 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.