Go to the first, previous, next, last section, table of contents.


CNPrioQueueFIFO -- Queue with priority

SYNOPSIS

#include <CNCL/PrioQueueFIFO.h>

TYPE

CN_PRIOQUEUEFIFO

BASE CLASSES

CNQueue

DERIVED CLASSES

None

RELATED CLASSES

CNDLList, CNQueueFIFO, CNQueueLIFO, CNQueueRandom, CNQueueSPT, CNSink, CNJob, CNStack

DESCRIPTION

CNPrioQueueFIFO is a queue, implemented as some FIFO queues, that can contain any number (well, sort of ... ;-) CNCL compatible (restrictions see below) objects. A priority queue consists of a number of simple FIFO queues, one for each priority. The priority value (0 to ...) is taken from the public identifier priority of the CNJob object. Lower values mean higher priority in access. Only objects derived from CNJob are accepted.

Constructors:

CNPrioQueueFIFO();
CNPrioQueueFIFO(CNParam *param);
CNPrioQueueFIFO(int prios);
Initialize the priority-queue to an empty state. The prios value determines the number of different priority steps for. By default prios is set to two.

In addition to the member functions required by CNCL, CNPrioQueueFIFO provides:

virtual bool empty() const;
Returns TRUE, if all internal queues are empty.
virtual bool full() const;
Always returns FALSE.
virtual int length() const;
Returns the actual queue length, that means the sum of all internal queues.
virtual void put(CNObject *obj);
Puts an object into the queue. Only objects derived from CNJob may be put into a priority queue.
virtual CNObject *get();
Retrieves an object from the queue. If there are objects in more than one internal queue the object with the lowest value in priority is retrieved.
virtual CNObject *peek();
Retrieves an object from the queue. Unlike get(), the object is not removed from the queue.
virtual void delete_all();
Deletes all objects in the queue.
int priorities();
Returns the number of different prioritie steps.


Go to the first, previous, next, last section, table of contents.