Go to the previous, next section.
#include <nihcl/OIOTbl.h>
The abstract class
StoreOnTbl
serves as the base class for classes
OIOofd
and
OIOout
, and maintains tables used by the
storeOn(OIOofd&)
and
storeOn(OIOout&)
member functions to perform object output.
If
MI
is defined, class
StoreOnTbl
also maintains an
IdentSet
to eliminate multiple calls to
storer()
for instances of classes used as virtual base classes.
The
storeOn(OIOofd&)
and
storeOn(OIOout&)
member functions reset the
StoreOnTbl
of their argument when first applied to an object to store it--recursive calls to
storeOn()
during an object store operation do not reset the
StoreOnTbl
. The information in the
StoreOnTbl
persists after the top-level call to
storeOn()
returns, and may be accessed via calls to
classesStored()
,
objectsStored()
, and
membersStored()
.
OrderedCltn classesStored()
OrderedCltn objectsStored()
OrderedCltn membersStored()
OrderedCltn
containing pointers to all the class descriptors, objects, or member objects, respectively, stored by the most recent call to
storeOn()
with an instance derived from this
StoreOnTbl
as an argument.
The
OrderedCltn
returned by
classesStored()
is ordered by the class number assigned during the
storeOn()
operation, with index 0 corresponding to class number 1. The
OrderedCltn
returned by
objectsStored()
is ordered by the object number assigned during the
storeOn()
operation, with index 0 corresponding to object number 0, which is always the
Nil
object. The
OrderedCltn
of member objects returned by
membersStored()
is in no particular order, since member objects are not assigned numbers when stored.
unsigned long storeOnLevel()
storeOn()
for this
StoreOnTbl
.
bool _storeVBase(const void*
p)
NO
if the (sub)object at address
p
has already been stored on this
StoreOnTbl
; otherwise, records the (sub)object at address
p
as having been stored and returns
YES
. Called by
storeVBaseOn()
to determine if
storer()
needs yet to be applied to an instance of a class used as a virtual base class.
virtual void dumpOn(ostream&
strm
=cerr) const
storeOn()
nesting level, highest assigned class and object numbers, and the stored class descriptor and object tables on the output stream
strm.
StoreOnTbl(unsigned
capacity
=256)
StoreOnTbl
with an initial object dictionary capacity of
capacity
objects. If an attempt is made to store more than
capacity
objects, the object dictionary capacity is increased. Since this is an expensive operation, it is wise to supply a reasonable estimate for
capacity.
bool add(const Object&
ob, int&
num)
NO
if the argument object
ob
has already been added to this
StoreOnTbl
by a previous call to
StoreOnTbl::add()
. Raises an
NIHCL_STREFMBR
exception if
ob
was added to this
StoreOnTbl
by a previous call to
addMember()
. Otherwise, adds
ob
and returns
YES
. In either case
num
is set to the object's assigned number. The caller typically tests the return value and stores
ob
if it is
YES
, or stores a reference to the object's number if
NO
.
bool addClass(const Class*
cl, unsigned short&
num)
NO
if the argument class descriptor
cl
has already been added to this
StoreOnTbl
; otherwise, adds
cl
and returns
YES
. In either case
num
is set to the class's assigned number. The caller typically tests the return value and stores identification information for class
cl
if it is
YES
, or stores a reference to the class's number if
NO
.
void addMember(const Object&
ob)
StoreOnTbl
to check if the argument member object
ob
has already been added. If not, it adds
ob
and returns; otherwise, it raises an
NIHCL_STMBRREF
exception.
NIHCL_STMBRREF
,
NIHCL_STREFMBR
Go to the previous, next section.