NAME

OTC_Queue - Implements a FIFO or queue.

SYNOPSIS


#include <OTC/collctn/queue.hh>

template<class T>
class OTC_Queue
{
  public:
    static os_typespec* get_os_typespec();
    inline ~OTC_Queue();
    OTC_Queue();
    OTC_Queue(OTC_Queue<T> const& theQueue);
    OTC_Queue<T>& operator=(OTC_Queue<T> const& theQueue);
    inline OTC_Boolean isEmpty() const;
    inline u_int count() const;
    inline T& head();
    inline T const& head() const;
    void add(T const& theItem);
    T remove();
    inline void clear();
    void discard(u_int theCount);
};

CLASS TYPE

Concrete

DESCRIPTION

OTC_Queue implements a FIFO or queue. Note, that it is the user's responsibility to deal with deletion of objects held in the queue when it is parameterised over a pointer type; ie., this class works independently of the OTC_BaseActions class.

INITIALISATION

OTC_Queue();
OTC_Queue(OTC_Queue<T> const& theQueue);

ASSIGNMENT

OTC_Queue<T>& operator=(OTC_Queue<T> const& theQueue);

QUERY

inline OTC_Boolean isEmpty() const;
inline u_int count() const;
inline T& head();
inline T const& head() const;

MODIFICATION

void add(T const& theItem);
T remove();
inline void clear();
void discard(u_int theCount);

NOTES

To allow any number of items to be placed into the queue, it is implemented using a linked list. If efficiency is a concern, both in terms of speed and memory use, and there is a fixed upper bound on the number of items to be held, the class OTC_BoundedQueue may be more appropriate.

SEE ALSO

OTC_BoundedQueue

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

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