WWC snapshot of http://www.alw.nih.gov/Docs/NIHCL/nihcl_35.html taken on Sat Jun 10 19:13:53 1995

Go to the previous, next section.

OIOout--Abstract Class for Object Output

SYNOPSIS

#include <nihcl/OIO.h>

BASE CLASS

StoreOnTbl

DERIVED CLASSES

OIOostream

RELATED CLASSES

OIOin

DESCRIPTION

Class OIOout is the abstract base class for classes implementing various formats of object output for the storeOn() function. It declares pure virtual member functions for writing the fundamental data types, arrays of fundamental data types, and C-style (null-terminated) character strings. It also declares pure virtual member functions for setting and accessing the output format precision and field width.

Since all output functions are virtual, derived classes can easily provide a variety of output formats to a variety of output destinations, such as C++ iostreams. This is a more flexible form of object I/O than the file descriptor object I/O provided by classes OIOofd and OIOifd, but is less efficient.

CONSTRUCTORS

OIOout(unsigned capacity =256)
Constructs an OIOout with an initial object capacity of capacity objects (see class StoreOnTbl).

OUTPUT FUNCTIONS

virtual OIOout& operator<<(const char*) = 0
Stores the null-terminated character string pointed to by the right operand and returns a reference to this OIOout if successful.

virtual OIOout& operator<<(char) = 0
virtual OIOout& operator<<(unsigned char) = 0
virtual OIOout& operator<<(short) = 0
virtual OIOout& operator<<(unsigned short) = 0
virtual OIOout& operator<<(int) = 0
virtual OIOout& operator<<(unsigned int) = 0
virtual OIOout& operator<<(long) = 0
virtual OIOout& operator<<(unsigned long) = 0
virtual OIOout& operator<<(float) = 0
virtual OIOout& operator<<(double) = 0
Stores the right operand and returns a reference to this OIOout if successful.

virtual OIOout& put(char val) = 0
Stores the single character val and returns a reference to this OIOout if successful.

virtual OIOout& put(const char* val, unsigned size) = 0
virtual OIOout& put(const unsigned char* val, unsigned size) = 0
virtual OIOout& put(const short* val, unsigned size) = 0
virtual OIOout& put(const unsigned short* val, unsigned size) = 0
virtual OIOout& put(const int* val, unsigned size) = 0
virtual OIOout& put(const unsigned int* val, unsigned size) = 0
virtual OIOout& put(const long* val, unsigned size) = 0
virtual OIOout& put(const unsigned long* val, unsigned size) = 0
virtual OIOout& put(const float* val, unsigned size) = 0
virtual OIOout& put(const double* val, unsigned size) = 0
Stores size elements from the array pointed to by val and returns a reference to this OIOout if successful.

virtual OIOout& putCString(const char* s) = 0
Stores the C-style (null-terminated) string pointed to by s and returns a reference to this OIOout if successful.

virtual int precision(int n) = 0
Sets the number of significant digits inserted by the floating point inserter to n and returns the previous value.

virtual int precision() = 0
Returns the number of significant digits inserted by the floating point inserter.

virtual int width(int n) = 0
Sets the field width to n and returns the previous value.

virtual int width() = 0
Returns the current field width.

PROTECTED MEMBERS

Object I/O

void _storer(const Object& ob) { ob.storer(*this); }
Stores the argument object ob on this OIOout by applying the virtual storer() function to it with this OIOout as the argument.

virtual void storeObject(const Object& ob) = 0
Stores the argument object ob on this OIOout. Decides whether to store the object's class description or a reference to a previous class description. Decides whether to store the object itself, or a reference to a previously stored object.

EXCEPTIONS RAISED

None

Go to the previous, next section.