Nagios
4.4.6
Dev docs for Nagios core and neb-module hackers
|
Go to the documentation of this file.
17 #ifndef LIBNAGIOS_PQUEUE_H_INCLUDED
18 #define LIBNAGIOS_PQUEUE_H_INCLUDED
41 typedef void (*pqueue_set_pri_f)(
void *a,
pqueue_pri_t pri);
47 typedef void (*pqueue_set_pos_f)(
void *a,
unsigned int pos);
86 pqueue_cmp_pri_f cmppri,
88 pqueue_set_pri_f setpri,
90 pqueue_set_pos_f setpos);
unsigned int pqueue_size(pqueue_t *q)
return the size of the queue.
void * pqueue_pop(pqueue_t *q)
pop the highest-ranking item from the queue.
void pqueue_free(pqueue_t *q)
free all memory used by the queue
void pqueue_print(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
print the queue
void pqueue_change_priority(pqueue_t *q, pqueue_pri_t new_pri, void *d)
move an existing entry to a different priority
int pqueue_remove(pqueue_t *q, void *d)
remove an item from the queue.
unsigned int(* pqueue_get_pos_f)(void *a)
callback functions to get/set the position of an element
Definition: pqueue.h:46
void pqueue_dump(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
dump the queue and it's internal structure
unsigned long long pqueue_pri_t
priority data type (used to be double, but ull is 107 times faster)
Definition: pqueue.h:37
unsigned int step
growth stepping setting
Definition: pqueue.h:59
pqueue_get_pos_f getpos
callback to get position of a node
Definition: pqueue.h:63
pqueue_cmp_pri_f cmppri
callback to compare nodes
Definition: pqueue.h:60
int pqueue_insert(pqueue_t *q, void *d)
insert an item into the queue.
struct pqueue_t pqueue_t
the priority queue handle
the priority queue handle
Definition: pqueue.h:55
void ** d
The actual queue in binary heap form.
Definition: pqueue.h:65
pqueue_pri_t(* pqueue_get_pri_f)(void *a)
callback functions to get/set/compare the priority of an element
Definition: pqueue.h:40
void * pqueue_peek(pqueue_t *q)
access highest-ranking item without removing it.
int pqueue_is_valid(pqueue_t *q)
checks that the pq is in the right order, etc
unsigned int avail
slots available in this queue
Definition: pqueue.h:58
pqueue_set_pri_f setpri
callback to set priority of a node
Definition: pqueue.h:62
pqueue_t * pqueue_init(unsigned int n, pqueue_cmp_pri_f cmppri, pqueue_get_pri_f getpri, pqueue_set_pri_f setpri, pqueue_get_pos_f getpos, pqueue_set_pos_f setpos)
initialize the queue
pqueue_set_pos_f setpos
callback to set position of a node
Definition: pqueue.h:64
pqueue_get_pri_f getpri
callback to get priority of a node
Definition: pqueue.h:61
unsigned int size
number of elements in this queue
Definition: pqueue.h:57
void(* pqueue_print_entry_f)(FILE *out, void *a)
debug callback function to print a entry
Definition: pqueue.h:51