void pqueue_print(pqueue_t *q, pqueue_print_entry_f print)
Print the contents of the queue.
int(* pqueue_cmp_pri_f)(pqueue_pri_t next, pqueue_pri_t curr)
Callback to compare two priorities.
Definition pqueue_base.h:73
void * pqueue_find_same_priority(pqueue_t *q, void *e)
Return an entry with the same priority as the specified entry or NULL if there is no such entry.
size_t(* pqueue_get_pos_f)(void *a)
Callback functions to get the position of an element.
Definition pqueue_base.h:85
pqueue_t * pqueue_init(size_t n, pqueue_cmp_pri_f cmppri, pqueue_get_pri_f getpri, pqueue_get_pos_f getpos, pqueue_set_pos_f setpos, pqueue_eq_elem_f eqelem, pqueue_print_entry_f prt)
Allocate and initialize a priority queue.
int(* pqueue_eq_elem_f)(void *next, void *curr)
Callback to determine whether two elements are equivalent.
Definition pqueue_base.h:79
void * pqueue_pop(pqueue_t *q)
Pop the highest-ranking item from the queue.
void(* pqueue_print_entry_f)(void *a)
Debug callback function to print a entry.
Definition pqueue_base.h:97
int pqueue_remove(pqueue_t *q, void *e)
Remove an item from the queue.
void * pqueue_find_equal_same_priority(pqueue_t *q, void *e)
Return an entry with the same priority (determined by cmppri) that matches the supplied entry (determ...
void * pqueue_peek(pqueue_t *q)
Access highest-ranking item without removing it.
void pqueue_empty_into(pqueue_t **dest, pqueue_t **src)
Empty 'src' into 'dest'.
pqueue_pri_t(* pqueue_get_pri_f)(void *a)
Callback to get the priority of an element.
Definition pqueue_base.h:67
void pqueue_free(pqueue_t *q)
Free all memory used by the queue.
unsigned long long pqueue_pri_t
Priority data type.
Definition pqueue_base.h:61
int pqueue_insert(pqueue_t *q, void *d)
Insert an element into the queue.
size_t pqueue_size(pqueue_t *q)
Return the size of the queue.
void(* pqueue_set_pos_f)(void *a, size_t pos)
Callback functions to set the position of an element.
Definition pqueue_base.h:91
void pqueue_dump(pqueue_t *q, pqueue_print_entry_f print)
Dump the queue and it's internal structure.
int pqueue_is_valid(pqueue_t *q)
Check that the all entries are in the right order, etc.
The priority queue struct.
Definition pqueue_base.h:103
pqueue_set_pos_f setpos
Callback to set position of a node.
Definition pqueue_base.h:137
pqueue_get_pos_f getpos
Callback to get position of a node.
Definition pqueue_base.h:132
pqueue_eq_elem_f eqelem
Callback to compare elements.
Definition pqueue_base.h:142
size_t avail
Slots available in this queue.
Definition pqueue_base.h:112
size_t size
Number of elements in this queue plus 1.
Definition pqueue_base.h:107
void ** d
The actual queue in binary heap form.
Definition pqueue_base.h:152
size_t step
Growth stepping setting.
Definition pqueue_base.h:117
pqueue_get_pri_f getpri
Callback to get priority of a node.
Definition pqueue_base.h:127
pqueue_print_entry_f prt
Callback to print elements.
Definition pqueue_base.h:147
pqueue_cmp_pri_f cmppri
Callback to compare priorities.
Definition pqueue_base.h:122