![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Priority Queue function declarations used as a base for Lingua Franca priority queues. More...
#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | pqueue_t |
| The priority queue struct. More... | |
Typedefs | |
| typedef int(* | pqueue_cmp_pri_f) (pqueue_pri_t next, pqueue_pri_t curr) |
| Callback to compare two priorities. | |
| typedef int(* | pqueue_eq_elem_f) (void *next, void *curr) |
| Callback to determine whether two elements are equivalent. | |
| typedef size_t(* | pqueue_get_pos_f) (void *a) |
| Callback functions to get the position of an element. | |
| typedef pqueue_pri_t(* | pqueue_get_pri_f) (void *a) |
| Callback to get the priority of an element. | |
| typedef unsigned long long | pqueue_pri_t |
| Priority data type. | |
| typedef void(* | pqueue_print_entry_f) (void *a) |
| Debug callback function to print a entry. | |
| typedef void(* | pqueue_set_pos_f) (void *a, size_t pos) |
| Callback functions to set the position of an element. | |
| typedef struct pqueue_t | pqueue_t |
| The priority queue struct. | |
Functions | |
| void | pqueue_dump (pqueue_t *q, pqueue_print_entry_f print) |
| Dump the queue and it's internal structure. | |
| void | pqueue_empty_into (pqueue_t **dest, pqueue_t **src) |
| Empty 'src' into 'dest'. | |
| 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 (determined by eqelem) or NULL if there is no such entry. | |
| 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. | |
| void | pqueue_free (pqueue_t *q) |
| Free all memory used by the queue. | |
| 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_insert (pqueue_t *q, void *d) |
| Insert an element into the queue. | |
| int | pqueue_is_valid (pqueue_t *q) |
| Check that the all entries are in the right order, etc. | |
| void * | pqueue_peek (pqueue_t *q) |
| Access highest-ranking item without removing it. | |
| void * | pqueue_pop (pqueue_t *q) |
| Pop the highest-ranking item from the queue. | |
| void | pqueue_print (pqueue_t *q, pqueue_print_entry_f print) |
| Print the contents of the queue. | |
| int | pqueue_remove (pqueue_t *q, void *e) |
| Remove an item from the queue. | |
| size_t | pqueue_size (pqueue_t *q) |
| Return the size of the queue. | |
Priority Queue function declarations used as a base for Lingua Franca priority queues.
Copyright (c) 2014, Volkan Yazıcı volkan.yazici@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Modified by Marten Lohstroh (May, 2019). Changes:
Modified by Byeonggil Jun (Apr, 2024). Changes:
| void pqueue_dump | ( | pqueue_t * | q, |
| pqueue_print_entry_f | print ) |
Dump the queue and it's internal structure.
| q | The queue |
| The callback function to print the entry |
| int pqueue_is_valid | ( | pqueue_t * | q | ) |
Check that the all entries are in the right order, etc.
| q | The queue |