Tools.h++ Manual

104011 Tandem Computers Incorporated 3-5
3
Store size
RWspace ClassName::binaryStoreSize() const;
RWspace ClassName::recursiveStoreSize() const
;
These functions return the number of bytes of secondary storage necessary to
store an object of type
ClassName
to an
RWFile
using function
RWFile& operator<<(RWFile& file, const ClassName&);
They are useful for storing objects using classes
RWFileManager
and
RWBTreeOnDisk
. The second variant,
recursiveStoreSize()
, is used for
objects that inherit from
RWCollectable
and can calculate the number bytes
used in a recursive store, using function
RWFile& operator<<(RWFile& file, const RWCollectable&)
Stream I/O
ostream& operator<<(ostream& ostr, const ClassName& x);
istream& operator>>(istream& istr, const ClassName& x);
The overloaded l-shift operator
(<<)
taking an
ostream
object as its first
argument will print the contents of an object in a human-readable form.
Conversely, the overloaded r-shift operator (
>>
) taking an
istream
object as
its first argument will read and parse an object from the stream, using a
human-understandable format.
Note – that this contrasts with the persistence operators
RWvostream& operator<<(RWvostream& vstream, const
ClassName&);
RWvistream& operator>>(RWvistream& vstream,
ClassName&);
(see “Persistence” on page 4) which, although they may store and restore to a
stream, will not necessarily do so in a form that could be called “human-
readable”.