![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Priority queue that uses tags for sorting. More...
Go to the source code of this file.
Data Structures | |
| struct | pqueue_tag_element_t |
| The type for an element in a priority queue that is sorted by tag. More... | |
Typedefs | |
| typedef pqueue_t | pqueue_tag_t |
| Type of a priority queue sorted by tags. | |
Functions | |
| int | pqueue_tag_compare (pqueue_pri_t priority1, pqueue_pri_t priority2) |
| Callback comparison function for the tag-based priority queue. | |
| void | pqueue_tag_dump (pqueue_tag_t *q) |
| Dump the queue and it's internal structure. | |
| pqueue_tag_element_t * | pqueue_tag_find_equal_same_tag (pqueue_tag_t *q, pqueue_tag_element_t *e) |
| Return an item with the same tag (cmppri returns 0) that matches the supplied element (eqelem returns non-zero) or NULL if there is none. | |
| pqueue_tag_element_t * | pqueue_tag_find_with_tag (pqueue_tag_t *q, tag_t t) |
| Return the first item with the specified tag or NULL if there is none. | |
| void | pqueue_tag_free (pqueue_tag_t *q) |
| Free all memory used by the queue including elements that are marked dynamic. | |
| pqueue_tag_t * | pqueue_tag_init (size_t initial_size) |
| Create a priority queue sorted by tags. | |
| pqueue_tag_t * | pqueue_tag_init_customize (size_t initial_size, pqueue_cmp_pri_f cmppri, pqueue_eq_elem_f eqelem, pqueue_print_entry_f prt) |
| Create a priority queue that stores elements with a particular payload. | |
| int | pqueue_tag_insert (pqueue_tag_t *q, pqueue_tag_element_t *d) |
| Insert an element into the queue. | |
| int | pqueue_tag_insert_if_no_match (pqueue_tag_t *q, tag_t t) |
| Insert a tag into the queue if the tag is not already in the queue. | |
| int | pqueue_tag_insert_tag (pqueue_tag_t *q, tag_t t) |
| Insert a tag into the queue. | |
| pqueue_tag_element_t * | pqueue_tag_peek (pqueue_tag_t *q) |
| Return highest-ranking item (the one with the least tag) without removing it. | |
| tag_t | pqueue_tag_peek_tag (pqueue_tag_t *q) |
| Return the least tag in the queue or FOREVER if the queue is empty. | |
| pqueue_tag_element_t * | pqueue_tag_pop (pqueue_tag_t *q) |
| Pop the least-tag element from the queue. | |
| tag_t | pqueue_tag_pop_tag (pqueue_tag_t *q) |
| Pop the least-tag element from the queue and return its tag. | |
| void | pqueue_tag_remove (pqueue_tag_t *q, pqueue_tag_element_t *e) |
| Remove an item from the queue. | |
| void | pqueue_tag_remove_up_to (pqueue_tag_t *q, tag_t t) |
| Remove items from the queue with tags up to and including the specified tag. | |
| size_t | pqueue_tag_size (pqueue_tag_t *q) |
| Return the size of the queue. | |
Priority queue that uses tags for sorting.
This file extends the pqueue infrastructure with support for queues that are sorted by tag instead of by a long long. Elements in this queue are structs of type pqueue_tag_element_t or a derived struct, as explained below. What you put onto the queue is a pointer to a tagged_element_t struct. That pointer, when cast to pqueue_pri_t, an alias for long long, also serves as the "priority" for the queue.
| void pqueue_tag_dump | ( | pqueue_tag_t * | q | ) |
Dump the queue and it's internal structure.
| q | the queue |