SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
A portable output stream based on XDR routines. More...
#include <rw/xdrstrea.h>
Public Member Functions | |
RWXDRostream (XDR *xp) | |
RWXDRostream (std::streambuf *) | |
RWXDRostream (std::ostream &) | |
virtual | ~RWXDRostream () |
virtual int | eof () |
virtual int | fail () |
virtual int | bad () |
virtual int | good () |
virtual int | rdstate () |
virtual void | clear (int v=0) |
virtual RWvostream & | putString (const char *s, size_t N) |
virtual RWvostream & | operator<< (const char *s) |
virtual RWvostream & | operator<< (char c) |
virtual RWvostream & | operator<< (unsigned char c) |
virtual RWvostream & | operator<< (wchar_t wc) |
virtual RWvostream & | operator<< (short s) |
virtual RWvostream & | operator<< (unsigned short s) |
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<< (double d) |
virtual RWvostream & | operator<< (float f) |
virtual RWvostream & | operator<< (long double) |
virtual RWvostream & | operator<< (long long) |
virtual RWvostream & | operator<< (unsigned long long) |
virtual RWvostream & | flush () |
virtual RWvostream & | put (char c) |
virtual RWvostream & | put (const char *p, size_t N) |
virtual RWvostream & | put (unsigned char c) |
virtual RWvostream & | put (const unsigned char *p, size_t N) |
virtual RWvostream & | put (wchar_t wc) |
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 RWvostream & | put (const long double *, size_t) |
virtual RWvostream & | put (const long long *, size_t) |
virtual RWvostream & | put (const unsigned long long *, size_t) |
virtual RWvostream & | putSizeT (size_t) |
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 outputing from a stream and encoding an XDR structure from a machine representation. RWXDRostream provides the ability 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().
#include <rw/xdrstrea.h> XDR xdr; xdrstdio_create(&xdr, stdout, XDR_ENCODE) ; RWXDRostream rw_xdr(&xdr);
None
#include <iostream> #include <rw/xdrstrea.h> int main () { XDR xdr; FILE* fp = fopen("test","w+"); if (fp == 0) { std::cerr << "failed to open file.\n"; return 1; } xdrstdio_create(&xdr, fp, XDR_ENCODE); RWXDRostream rw_xdr (&xdr); for(int i = 0; i < 10; ++i) rw_xdr << i; // encode integer data fclose(fp); return 0; }
RWXDRostream::RWXDRostream | ( | XDR * | xp | ) |
Initializes an RWXDRostream from the XDR structure xp.
RWXDRostream::RWXDRostream | ( | std::streambuf * | ) |
Initializes an RWXDRostream with a pointer to streambuf
. streambuf
must already be allocated.
RWXDRostream::RWXDRostream | ( | std::ostream & | ) |
Initializes an RWXDRostream with an output stream.
virtual RWXDRostream::~RWXDRostream | ( | ) | [virtual] |
Deallocates previously allocated resources.
virtual int RWXDRostream::bad | ( | ) | [inline, virtual] |
Returns a nonzero integer if the bad bit has been set. Normally this indicates that a severe error has occurred from which recovery is probably impossible.
Implements RWvostream.
virtual void RWXDRostream::clear | ( | int | v = 0 |
) | [inline, virtual] |
Sets the current error state to v. If v is zero, then this clears the error state.
Implements RWvostream.
virtual int RWXDRostream::eof | ( | ) | [inline, virtual] |
Returns a nonzero integer if an EOF
is encountered.
Implements RWvostream.
virtual int RWXDRostream::fail | ( | ) | [inline, virtual] |
Returns a nonzero integer if the failed or bad bit has been set. Normally, this indicates that some storage or retrieval has failed, but that the stream is still in a usable state.
Implements RWvostream.
virtual RWvostream& RWXDRostream::flush | ( | ) | [virtual] |
Sends the contents of the stream buffer to output immediately.
Implements RWvostream.
virtual int RWXDRostream::good | ( | ) | [inline, virtual] |
Returns a nonzero integer if no error bits have been set.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | unsigned long | i | ) | [inline, virtual] |
Stores the unsigned long long
i to the output stream.
unsigned long long
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | long | i | ) | [inline, virtual] |
Stores the long long
i to the output stream.
long long
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | long | d | ) | [inline, virtual] |
Stores the long double
d to the output stream.
long double
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | float | f | ) | [virtual] |
Stores the float
f to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | double | d | ) | [virtual] |
Stores the double
d to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | unsigned long | l | ) | [virtual] |
Stores the unsigned
long
l to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | long | l | ) | [virtual] |
Stores the long
l to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | unsigned int | i | ) | [virtual] |
Stores the unsigned integer
i to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | int | i | ) | [virtual] |
Stores the integer
i to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | unsigned short | s | ) | [virtual] |
Stores the unsigned short
s to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | short | s | ) | [virtual] |
Stores the short
s to the output stream, using the XDR format.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | wchar_t | wc | ) | [virtual] |
Stores the wide character wc to the output stream, using the XDR format. Note that wc is treated as a character, not a number.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | unsigned char | c | ) | [virtual] |
Stores the unsigned character c to the output stream, using the XDR format. Note that c is treated as a character, not a number.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | char | c | ) | [virtual] |
Stores the character c to the output stream, using the XDR format. Note that c is treated as a character, not a number. This method attempts to preserve the symbolic character values transmitted over the stream.
Implements RWvostream.
virtual RWvostream& RWXDRostream::operator<< | ( | const char * | s | ) | [virtual] |
Stores the character string starting at s to the output stream, using the XDR format. The character string is expected to be null terminated.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const unsigned long long * | v, | |
size_t | N | |||
) | [inline, virtual] |
Stores the vector of N unsigned long long
starting at v to the output stream.
unsigned long long
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const long long * | v, | |
size_t | N | |||
) | [inline, virtual] |
Stores the vector of N long long
starting at v to the output stream.
long long
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const long double * | v, | |
size_t | N | |||
) | [inline, virtual] |
Stores the vector of N long double
starting at v to the output stream.
long double
type. Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const double * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N double
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const float * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N float
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const unsigned long * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N unsigned long
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const long * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N long
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const unsigned int * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N unsigned integer
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const int * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N integer
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const unsigned short * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N unsigned short
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const short * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N short
starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const wchar_t * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N wide characters starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | wchar_t | wc | ) | [virtual] |
Stores the wide character wc to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const unsigned char * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N unsigned char
starting at v to the output stream.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | unsigned char | c | ) | [virtual] |
Stores the unsigned character c to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | const char * | p, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N characters starting at p to the output stream, using the XDR format. If the operation fails, the method sets the failbit.
Implements RWvostream.
virtual RWvostream& RWXDRostream::put | ( | char | c | ) | [virtual] |
Stores the character c to the output stream, using the XDR format. If the operation fails, the method sets the failbit. This method preserves only US-ASCII numerical codes, not the corresponding character symbol.
Implements RWvostream.
virtual RWvostream& RWXDRostream::putSizeT | ( | size_t | sz | ) | [virtual] |
Stores the size_t
sz to the output stream.
Implements RWvostream.
virtual RWvostream& RWXDRostream::putString | ( | const char * | s, | |
size_t | N | |||
) | [virtual] |
Stores the first N characters of character string s for retrieval by RWXDRistream::getString().
Implements RWvostream.
virtual int RWXDRostream::rdstate | ( | ) | [inline, virtual] |
Returns the current error state.
Implements RWvostream.
© 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.