Persistence Functions
The Essential Tools Module uses the following member functions to store an object of type
ClassName to and from an
RWFile, and to and from the Rogue Wave virtual streams facility, and to restore it later:
RWFile& operator<<(RWFile& file, const ClassName&);
RWFile& operator>>(RWFile& file, ClassName&);
RWvostream& operator<<(RWvostream& vstream,const ClassName&);
RWvistream& operator>>(RWvistream& vstream, ClassName&);
Class
RWFile, which encapsulates lower levelC I/O API efficiently, saves/restores objects to/from files. The result is efficient storage and retrieval to files. For more information on
RWFile, see
Chapter 10 and the
SourcePro API Reference Guide.
Classes
RWvistream and
RWvostream are abstract base classes used by the Rogue Wave virtual streams facility. The final output format is determined by the specializing class. For example,
RWpistream and
RWpostream are two classes that derive from
RWvistream and
RWvostream, respectively. They store and retrieve objects using a portable ASCII format. The results can be transferred between different operating systems. These classes are discussed in more detail in
Chapter 5 and the
SourcePro API Reference Guide.
You can decide whether to store to
RWFiles or to Rogue Wave streams. Storing to
RWFiles gives you speed, but limits portability of results to the host machine and operating system. Storing to Rogue Wave streams is not as fast, but you get several specializing classes that provide other useful features. These features include a highly portable format between different machines and XDR stream encapsulation for distributed computations.