A priority queue.
More...
Detailed Description
A priority queue.
Implementation based on a heap datastructure
Typedef Documentation
priority queue
Definition at line 41 of file pqueue.h.
Function Documentation
Frees all memory allocated by the priority queue.
- Parameters
-
q | The priority queue to destroy. |
Creates a new priority queue.
- Returns
- A priority queue of initial length 0.
Returns true if queue is empty.
- Parameters
-
- Returns
- 1 if the queue is empty, 0 otherwise.
size_t pqueue_length |
( |
const pqueue_t * |
q | ) |
|
Get the length of the priority queue.
- Parameters
-
- Returns
- The length of the queue.
Returns and removes the first element, ie.
that one with the highest priority, from the queue.
- Parameters
-
- Returns
- The first element of the queue. Asserts if queue is empty.
void pqueue_put |
( |
pqueue_t * |
q, |
|
|
void * |
data, |
|
|
int |
priority |
|
) |
| |
Inserts a new element into a priority queue.
- Parameters
-
q | The priority queue the element should be inserted to. |
data | The actual data which should be stored in the queue. |
priority | The priority for the data. |