NAME

OTC_Deque - A deque.

SYNOPSIS


#include <OTC/collctn/deque.hh>

template<class T>
class OTC_Deque
{
  public:
    static os_typespec* get_os_typespec();
    typedef OTC_Modifier<T> type1;
    type1 dummy1();
    inline ~OTC_Deque();
    inline OTC_Deque();
    OTC_Deque(OTC_Deque<T> const& theDeque);
    OTC_Deque(OTC_Deque<T>& theDeque, OTC_ShallowCopy);
    OTC_Deque<T>& operator=(OTC_Deque<T> const& theDeque);
    inline u_int population() const;
    inline OTC_Boolean isEmpty() const;
    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();
    inline void removeFirst();
    inline void removeLast();
    inline OTC_Iterator<T> items(
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    ) const;
    inline OTC_Modifier<T> items(
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    );
  protected:
    OTC_Cursor<T>* _items(
      OTC_Direction theDirection,
      OTC_Protection theProtection
    ) const;
    OTC_Link* _link(T const& theItem);
};

CLASS TYPE

Concrete

DESCRIPTION

OTC_Deque implements a list of objects where access to and manipulation of items, is only permitted on items occurring at the ends of the list.

INITIALISATION

inline OTC_Deque();
OTC_Deque(OTC_Deque<T> const& theDeque);
OTC_Deque(OTC_Deque<T>& theDeque, OTC_ShallowCopy);

ASSIGNMENT

OTC_Deque<T>& operator=(OTC_Deque<T> const& theDeque);

QUERY

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

ADDITION

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

ACCESS

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

REMOVAL

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

ITERATION

By default, iterators will perform reference counts on the buckets in the collection as the iterator moves over the items. Performing the reference counts ensures that the iterator is not corrupted by additions or removals to the collection. If an unsafe iterator is required, for example, to avoid grabbing a write lock when using ObjectStore, a second argument can be passed to the following functions. The value of this argument is either OTCLIB_SAFE or OTCLIB_UNSAFE. To get an unsafe iterator, the OTCLIB_UNSAFE argument should be used. The first argument to the following functions indicates the direction of traversal of the iterator. Traversal in the direction of first to last item is indicated by a value of OTCLIB_FORWARD. Traversal in the reverse direction is indicated by a value of OTCLIB_BACKWARD. The default value is OTCLIB_FORWARD.
inline OTC_Iterator<T> items(
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
) const;
inline OTC_Modifier<T> items(
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
);

NOTES

The OTC_Bucket class is used internally to hold items in the list. Thus, the OTC_BaseActions class may be used to provide actions to be performed, when items are inserted and removed from the list.

SEE ALSO

OTC_Iterator, OTC_Modifier, OTC_Bucket, OTC_BaseActions

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

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