#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);
};
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.
OTC_Queue();
OTC_Queue(OTC_Queue<T> const& theQueue);
theQueue
. If the queue is holding
pointers, only the value of the pointer
is copied and not the object being
pointed at.
OTC_Queue<T>& operator=(OTC_Queue<T> const& theQueue);
theQueue
. If the queue is holding
pointers, only the value of the pointer
is copied and not the object being
pointed at.
inline OTC_Boolean isEmpty() const;
OTCLIB_TRUE
if the queue is empty.
inline u_int count() const;
inline T& head();
inline T const& head() const;
void add(T const& theItem);
theItem
onto the tail of the
queue.
T remove();
inline void clear();
void discard(u_int theCount);
theCount
items
on the queue. If there are not that
many items on the queue, an exception
is raised.
OTC_BoundedQueue
may
be more appropriate.
OTC_BoundedQueue