NAME

OTC_LinkList - A doubly linked list.

SYNOPSIS


#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);
};

CLASS TYPE

Concrete

DESCRIPTION

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.

DESTRUCTION

~OTC_LinkList();
void removeAll();

QUERY

u_int population() const;
OTC_Boolean isEmpty() const;

ITERATION

inline OTC_LinkIterator items(
  OTC_Protection theProtection=OTCLIB_SAFE
) const;

ACCESS

OTC_Link* first() const;
OTC_Link* last() const;

INSERTION

inline void addFirst(OTC_Link* theLink);
inline void addLast(OTC_Link* theLink);

NOTE

Any instances of objects derived from 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.

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED