#include <OTC/collctn/linklist.hh> class OTC_LinkList : public OTC_Resource {
public:
static os_typespec* get_os_typespec();
OTC_LinkList();
~OTC_LinkList();
void removeAll();
u_int population() const;
OTC_Boolean isEmpty() const;
inline OTC_LinkIterator items( OTC_Protection theProtection=OTCLIB_SAFE ) const;
OTC_Link* first() const;
OTC_Link* last() const;
inline void addFirst(OTC_Link* theLink);
inline void addLast(OTC_Link* theLink);
};
OTC_LinkList
provides the anchor points on which to hang a list
of objects derived from the OTC_Link
class. The class gives easy
access to the start and end of the list, and the ability to insert
objects at the start and end.
If it is necessary to insert objects into the middle of the list,
you will need to use the iterator to get to a point, adjacent
to where the insertion is required, and use either of the
addBefore()
and addAfter()
operations provided by the
OTC_Link
object.
~OTC_LinkList();
removeAll()
to kill all the
links in the list.
void removeAll();
u_int population() const;
OTC_Boolean isEmpty() const;
OTCLIB_TRUE
if the list is empty.
inline OTC_LinkIterator items(
OTC_Protection theProtection=OTCLIB_SAFE
) const;
theProtection
determines whether reference counting is
performed on the links in the list.
Reference counting ensures the integrity of
the iterator when removals and additions
are perfomed. The values for
theProtection
are OTCLIB_SAFE
and
OTCLIB_UNSAFE
. The default argument is
OTCLIB_UNSAFE
.
OTC_Link* first() const;
0
if the list is empty.
OTC_Link* last() const;
0
if the list is empty.
inline void addFirst(OTC_Link* theLink);
theLink
at the start of the list.
inline void addLast(OTC_Link* theLink);
theLink
at the end of the list.
OTC_Link
placed into
the list, must be created on the free store. If objects created
on the stack, at global scope, or as members of another object are
added to the list, the result is undefined. In this situation,
the destructor of the object added to the list will ultimately
have its destructor invoked twice.