NAME

OTC_IList - Linked list with inbuilt iterator.

SYNOPSIS


#include <OTC/collctn/ilist.hh>

template<class T>
class OTC_IList
{
  public:
    static os_typespec* get_os_typespec();
    OTC_IList();
    OTC_IList(OTC_IList<T> const& theList);
    OTC_IList(OTC_IList<T> const& theList, OTC_ShallowCopy);
    ~OTC_IList();
    OTC_IList<T>& operator=(OTC_IList<T> const& theList);
    inline u_int population() const;
    inline OTC_Boolean isEmpty() const;
    inline T& item();
    inline T const& item() const;
    inline OTC_Boolean isValid() const;
    inline OTC_Boolean isStart() const;
    inline OTC_Boolean isEnd() const;
    inline void next() const;
    inline void prev() const;
    inline void resetFirst() const;
    inline void resetLast() const;
    void apply(
      OTC_Visitor<T>& theApplicator,
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    ) const;
    void apply(
      OTC_Worker<T>& theApplicator,
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    );
    void addBefore(T const& theItem);
    void addAfter(T const& theItem);
    inline void addFirst(T const& theItem);
    inline void addLast(T const& theItem);
    inline T& first();
    inline T const& first() const;
    inline T& last();
    inline T const& last() const;
    inline void removeAll();
    void remove();
    inline void removeFirst();
    inline void removeLast();
};

CLASS TYPE

Concrete

DESCRIPTION

This class is a templated, minimal linked list, incorporating an inbuilt iterator. This would be used where the extra functionality of OTC_Deque or OTC_List is not required. This class replaces the OTC_SimpleList class. Items may be inserted at any position in the list by moving the inbuilt iterator to the required location and then adding the item, either before, or after the iterator position. It is also possible to add items directly onto the head or tail of the list. The class uses OTC_Bucket to hold items internally. Therefore, OTC_BaseActions can be used to define what occurs when items are added and removed from the list.

CONSTRUCTION

OTC_IList();
OTC_IList(OTC_IList<T> const& theList);
OTC_IList(OTC_IList<T> const& theList, OTC_ShallowCopy);

DESTRUCTION

~OTC_IList();

ASSIGNMENT

OTC_IList<T>& operator=(OTC_IList<T> const& theList);

POPULATION

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

ITERATION

inline T& item();
inline T const& item() const;
inline OTC_Boolean isValid() const;
inline OTC_Boolean isStart() const;
inline OTC_Boolean isEnd() const;
inline void next() const;
inline void prev() const;
inline void resetFirst() const;
inline void resetLast() const;

APPLICATORS

void apply(
  OTC_Visitor<T>& theApplicator,
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
) const;
void apply(
  OTC_Worker<T>& theApplicator,
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
);

ADDITION

void addBefore(T const& theItem);
void addAfter(T const& theItem);
inline void addFirst(T const& theItem);
inline void addLast(T const& theItem);

LOOKING

inline T& first();
inline T const& first() const;
inline T& last();
inline T const& last() const;

REMOVING

inline void removeAll();
void remove();
inline void removeFirst();
inline void removeLast();

SEE ALSO

OTC_Bucket, OTC_BaseActions

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

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