Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

7.1 Overview

Math.h++ comes with an extensive and powerful persistence facility which can faithfully store and restore your vectors and matrices. In Math.h++, store and restore are accomplished by the following member functions:

These functions can move objects to and from RWFile objects, and to and from the Rogue Wave virtual streams facility.

Class RWFile encapsulates ANSI-C file I/O. Objects saved through RWFile are saved in binary format, resulting in efficient storage and retrieval. Class RWFile is discussed in detail in the Class Reference

Classes RWvistream and RWvostream are abstract base classes of the Rogue Wave virtual streams facility. The specializing classes that derive from these abstract base classes determine their final output formats. For example, the classes RWpistream and RWpostream, which derive from RWvistream and RWvostream, respectively, store and retrieve objects using portable ASCII format. The results can even be transferred between different operating systems! These classes are discussed in more detail below, and in the Class Reference.

It is up to the user to decide whether to store to RWFiles or to virtual streams. RWFiles offer the advantage of speed, but limit portability of the results to the host machine. Virtual streams are not as fast, but the specializing classes RWpistream and RWpostream allow the results to be moved to any machine.

There is one final way to store and retrieve objects. The overloaded left shift operator << prints the contents of an object in a human-readable form. Conversely, the overloaded right shift operator >> reads and parses an object from an istream in a human-understandable format. Here are their prototypes:

For most objects, the output of operator<<() can be fed into operator>>(). Note that this approach contrasts with restoreFrom() and saveOn(), which may store and restore to an ASCII stream, but not necessarily in a form that could be called human-readable.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.