Common member functions, Persistence, Store size – HP Integrity NonStop J-Series User Manual
Page 32

Click on the banner to return to the user guide home page.
©Copyright 1996 Rogue Wave Software
Common Member Functions
Whatever their category, all classes have similar programming interfaces. This section
highlights their common functionality.
Persistence
Tools.h++ 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 ANSI-C file I/O, saves objects in binary format. The result is
efficient storage and retrieval to files. For more information on
RWFile
, see
and the
Class Reference.
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
and the Class Reference.
It's up to you to decide whether to store to
RWFile
s, 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, including highly portable format between different machines,
and XDR stream encapsulation for distributed computations.
Store Size
The following common member functions return the number of bytes of secondary storage
necessary to store an object of type ClassName to an
RWFile
: