GPL_CircularQueue
GPL_CircularQueue
gpl
1998 12-05
CLASS
GPL_CircularQueue - C++ circular queue template
SYNOPSIS
GPL_CircularQueue<data_type> cqueue(block_size);
Class GPL_CircularQueue is a C++ template for a circular queue.
This container type can be used as a general circular queue, a FIFO,
or a stack depending on which member functions are used.
GPL_CircularQueue is dynamic in that its allocated size adapts to the number
of elements in the queue. The grain size of the dynamic memory management is
specified by the constructor argument block_size.
In other words, space is allocated and deallocated in blocks of size
block_size * sizeof(data_type *).
This class does not automatically allocate space for the data_type
object themselves, just for the pointers.
CONSTRUCTOR
GPL_CircularQueue(long block_size)
Construct a circular queue of pointers to type data_type
with a dynamic resizing grain size of block_size.
MEMBER FUNCTIONS
long AddHead(data_type *entry)
Add entry to the head of the queue.
Return TRUE on success, FALSE on failure.
long AddTail(data_type *entry)
Add entry to the tail of the queue.
Return TRUE on success, FALSE on failure.
data_type *RemoveHead()
Remove the object at the head of queue and return the pointer to the removed
object.
data_type *RemoveTail()
Remove the object at the tail of queue and return the pointer to the removed
object.
long GetSize(void)
Return the number of elements currently in the queue.