#ifndef PRIORITYQ_H
#define PRIORITYQ_H
/* Priority queue implementation using heap. The items you add to the queue
must begin with a struct priorityq_item. This is necessary for
priorityq_remove() to work fast. */
struct priorityq_item {
/* Current index in the queue array, updated automatically. */
unsigned int idx;
/* [your own data] */
};
/* Returns <0, 0 or >0 */
/* Create a new priority queue. Callback is used to compare added items. */
struct priorityq *
/* Return number of items in the queue. */
/* Add a new item to the queue. */
/* Remove the specified item from the queue. */
/* Return the item with the highest priority. Returns NULL if queue is empty. */
/* Like priorityq_peek(), but also remove the returned item from the queue. */
/* Returns array containing all the priorityq_items. Only the first item is
guaranteed to be the highest priority item, the rest can't be assumed to
be in any order. */
#endif