4 * @author Christian Wuerdig
5 * @brief Implementation of a priority queue. This is the ported version of the
6 * original Java implementation by Matthias Braun.
13 typedef struct _pqueue_t pqueue;
16 * Creates a new priority queue.
17 * @return A priority queue of initial length 0.
19 pqueue *new_pqueue(void);
22 * Frees all memory allocated by the priority queue.
23 * @param q The priority queue to destroy.
25 void del_pqueue(pqueue *q);
28 * Inserts a new element into a priority queue.
29 * @param q The priority queue the element should be inserted to.
30 * @param data The actual data which should be stored in the queue.
31 * @param key The priority for the data.
33 void pqueue_put(pqueue *q, void *data, double key);
36 * Returns and removes the first element, ie. that one with the highest priority, from the queue.
37 * @param q The priority queue.
38 * @return The first element of the queue. Asserts if queue is empty.
40 void *pqueue_get(pqueue *q);
43 * Get the length of the priority queue.
44 * @param q The priority queue.
45 * @return The length of the queue.
47 int pqueue_length(pqueue *q);
50 * Returns true if queue is empty.
51 * @param q The priority queue.
52 * @return 1 if the queue is empty, 0 otherwise.
54 int pqueue_empty(pqueue *q);
56 #endif /* _PQUEUE_H_ */