Go to the previous, next section.
#include <nihcl/OIOTbl.h>
The abstract class
ReadFromTbl
serves as the base class for classes
OIOifd
and
OIOin
, and maintains tables used by the
readFrom(OIOifd&)
and
readFrom(OIOin&)
member functions to perform object input.
The
readFrom(OIOifd&)
and
readFrom(OIOin&)
member functions reset the
ReadFromTbl
of their argument when first applied to an object to store it--recursive calls to
readFrom()
during an object store operation do not reset the
ReadFromTbl
. The information in the
ReadFromTbl
persists after the top-level call to
readFrom()
returns, and may be accessed via calls to
classesRead()
and
objectsRead()
.
const Class* classAt(int
n)
readFrom()
with this
ReadFromTbl
as an argument.
Object* objectAt(int
n)
readFrom()
with this
ReadFromTbl
as an argument.
const Class* readFromClass()
readFrom()
constructor to determine if it has been called to initialize an instance of a base class (readFromClass() != isA()
), or if it is the constructor of the most-derived class of an object (readFromClass() == isA()
). This is useful when a
readFrom()
constructor must call virtual functions, to assure that it calls the intended implementations of these virtual functions.
OrderedCltn classesRead()
OrderedCltn objectsRead()
OrderedCltn
containing pointers to all the class descriptors or objects, respectively, read by the most recent call to
readFrom()
with an instance derived from this
ReadFromTbl
as an argument.
The
OrderedCltn
returned by
classesRead()
is ordered by the class number assigned during the
readFrom()
operation, with index 0 corresponding to class number 1. The
OrderedCltn
returned by
objectsRead()
is ordered by the object number assigned during the
readFrom()
operation, with index 0 corresponding to object number 0, which is always the
Nil
object.
unsigned long readFromLevel()
readFrom()
for this
ReadFromTbl
.
virtual void dumpOn(ostream&
strm
=cerr) const
readFrom()
nesting level, add object enable flag, and the read class descriptor and object tables on the output stream
strm.
ReadFromTbl(unsigned
capacity
=1024)
ReadFromTbl
with an initial object capacity of
capacity
objects. If an attempt is made to read more than
capacity
objects, the object dictionary capacity is increased.
void addObjectEnable()
add(Object&)
applied to this
ReadFromTbl
to be effective. Called from
Class::readObject()
.
void add(Object&
ob)
addObjectEnable()
has just been invoked, adds the argument object
ob
to this
ReadFromTbl
so that its address can be retrieved by calling
objectAt()
. Objects must be added in the order they are read from the object input stream so that
add()
assigns them the correct object number. Subsequent calls to
add(Object&)
are disabled until
addObjectEnable()
is called again.
int add(const Class*
cl)
ReadFromTbl
so that its address can be retrieved by calling
classAt()
. Returns the assigned class number. Classes must be added in the order they are read from the object input stream so that
add()
assigns them the correct class number.
const Class* readFromClass(const Class*
cl)
NIHCL_STMBRREF
,
NIHCL_STREFMBR
Go to the previous, next section.