MP5 Schedule Me!
|
Functions | |
void | priqueue_init (priqueue_t *q, int(*comparer)(const void *, const void *)) |
Initializes the priqueue_t data structure. | |
int | priqueue_offer (priqueue_t *q, void *ptr) |
Inserts the specified element into this priority queue. | |
void * | priqueue_peek (priqueue_t *q) |
Retrieves, but does not remove, the head of this queue, returning NULL if this queue is empty. | |
void * | priqueue_poll (priqueue_t *q) |
Retrieves and removes the head of this queue, or NULL if this queue is empty. | |
void * | priqueue_at (priqueue_t *q, int index) |
Returns the element at the specified position in this list, or NULL if the queue does not contain an index'th element. | |
int | priqueue_remove (priqueue_t *q, void *ptr) |
Removes all instances of ptr from the queue. | |
void * | priqueue_remove_at (priqueue_t *q, int index) |
Removes the specified index from the queue, moving later elements up a spot in the queue to fill the gap. | |
int | priqueue_size (priqueue_t *q) |
Returns the number of elements in the queue. | |
void | priqueue_destroy (priqueue_t *q) |
Destroys and frees all the memory associated with q. |
void* priqueue_at | ( | priqueue_t * | q, |
int | index | ||
) |
Returns the element at the specified position in this list, or NULL if the queue does not contain an index'th element.
q | a pointer to an instance of the priqueue_t data structure |
index | position of retrieved element |
void priqueue_destroy | ( | priqueue_t * | q | ) |
Destroys and frees all the memory associated with q.
q | a pointer to an instance of the priqueue_t data structure |
void priqueue_init | ( | priqueue_t * | q, |
int(*)(const void *, const void *) | comparer | ||
) |
Initializes the priqueue_t data structure.
Assumtions
q | a pointer to an instance of the priqueue_t data structure |
comparer | a function pointer that compares two elements. See also Compare Function |
int priqueue_offer | ( | priqueue_t * | q, |
void * | ptr | ||
) |
Inserts the specified element into this priority queue.
q | a pointer to an instance of the priqueue_t data structure |
ptr | a pointer to the data to be inserted into the priority queue |
void* priqueue_peek | ( | priqueue_t * | q | ) |
Retrieves, but does not remove, the head of this queue, returning NULL if this queue is empty.
q | a pointer to an instance of the priqueue_t data structure |
void* priqueue_poll | ( | priqueue_t * | q | ) |
Retrieves and removes the head of this queue, or NULL if this queue is empty.
q | a pointer to an instance of the priqueue_t data structure |
int priqueue_remove | ( | priqueue_t * | q, |
void * | ptr | ||
) |
Removes all instances of ptr from the queue.
This function should not use the comparer function, but check if the data contained in each element of the queue is equal (==) to ptr.
q | a pointer to an instance of the priqueue_t data structure |
ptr | address of element to be removed |
void* priqueue_remove_at | ( | priqueue_t * | q, |
int | index | ||
) |
Removes the specified index from the queue, moving later elements up a spot in the queue to fill the gap.
q | a pointer to an instance of the priqueue_t data structure |
index | position of element to be removed |
int priqueue_size | ( | priqueue_t * | q | ) |
Returns the number of elements in the queue.
q | a pointer to an instance of the priqueue_t data structure |