reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
pqueue_tag.h
Go to the documentation of this file.
1
16#ifndef PQUEUE_TAG_H
17#define PQUEUE_TAG_H
18
19#include "pqueue_base.h"
20#include "tag.h"
21
52typedef struct {
54 size_t pos; // Needed by any pqueue element.
55 int is_dynamic; // Non-zero to free this struct when the queue is freed.
57
62
71int pqueue_tag_compare(pqueue_pri_t priority1, pqueue_pri_t priority2);
72
80pqueue_tag_t* pqueue_tag_init(size_t initial_size);
81
95
102
109
118
130
142
150
159
166
173
183
193
201
210
218
219#endif // PQUEUE_TAG_H
int(* pqueue_cmp_pri_f)(pqueue_pri_t next, pqueue_pri_t curr)
Definition pqueue_base.h:58
int(* pqueue_eq_elem_f)(void *next, void *curr)
Definition pqueue_base.h:61
void(* pqueue_print_entry_f)(void *a)
Definition pqueue_base.h:70
unsigned long long pqueue_pri_t
Definition pqueue_base.h:52
size_t pqueue_tag_size(pqueue_tag_t *q)
Return the size of the queue.
Definition pqueue_tag.c:97
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.
Definition pqueue_tag.c:119
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.
Definition pqueue_tag.c:153
pqueue_tag_element_t * pqueue_tag_peek(pqueue_tag_t *q)
Return highest-ranking item (the one with the least tag) without removing it.
Definition pqueue_tag.c:127
pqueue_tag_t * pqueue_tag_init(size_t initial_size)
Create a priority queue sorted by tags.
Definition pqueue_tag.c:77
void pqueue_tag_dump(pqueue_tag_t *q)
Definition pqueue_tag.c:161
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.
Definition pqueue_tag.c:82
int pqueue_tag_insert(pqueue_tag_t *q, pqueue_tag_element_t *d)
Insert an element into the queue.
Definition pqueue_tag.c:99
void pqueue_tag_free(pqueue_tag_t *q)
Free all memory used by the queue including elements that are marked dynamic.
Definition pqueue_tag.c:88
int pqueue_tag_insert_tag(pqueue_tag_t *q, tag_t t)
Insert a tag into the queue.
Definition pqueue_tag.c:101
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.
Definition pqueue_tag.c:108
tag_t pqueue_tag_peek_tag(pqueue_tag_t *q)
Return the least tag in the queue or FOREVER if the queue is empty.
Definition pqueue_tag.c:129
tag_t pqueue_tag_pop_tag(pqueue_tag_t *q)
Pop the least-tag element from the queue and return its tag.
Definition pqueue_tag.c:139
pqueue_t pqueue_tag_t
Type of a priority queue sorted by tags.
Definition pqueue_tag.h:61
void pqueue_tag_remove(pqueue_tag_t *q, pqueue_tag_element_t *e)
Remove an item from the queue.
Definition pqueue_tag.c:151
int pqueue_tag_compare(pqueue_pri_t priority1, pqueue_pri_t priority2)
Callback comparison function for the tag-based priority queue. Return -1 if the first argument is les...
Definition pqueue_tag.c:71
pqueue_tag_element_t * pqueue_tag_pop(pqueue_tag_t *q)
Pop the least-tag element from the queue.
Definition pqueue_tag.c:137
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...
Definition pqueue_tag.c:115
Definition pqueue_base.h:73
The type for an element in a priority queue that is sorted by tag.
Definition pqueue_tag.h:52
tag_t tag
Definition pqueue_tag.h:53
size_t pos
Definition pqueue_tag.h:54
int is_dynamic
Definition pqueue_tag.h:55
Definition tag.h:78
Time and tag definitions and functions for Lingua Franca.