reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
pqueue_tag.h
Go to the documentation of this file.
1
15
16#ifndef PQUEUE_TAG_H
17#define PQUEUE_TAG_H
18
19#include "pqueue_base.h"
20#include "tag.h"
21
53typedef struct {
62
71 size_t pos;
72
84
90
100
109pqueue_tag_t* pqueue_tag_init(size_t initial_size);
110
127
134
141
150
162
174
183
193
201
209
219
229
237
246
252
253#endif // PQUEUE_TAG_H
size_t pqueue_tag_size(pqueue_tag_t *q)
Return the size of 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.
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.
pqueue_tag_element_t * pqueue_tag_peek(pqueue_tag_t *q)
Return highest-ranking item (the one with the least tag) without removing it.
int(* pqueue_cmp_pri_f)(pqueue_pri_t next, pqueue_pri_t curr)
Callback to compare two priorities.
Definition pqueue_base.h:73
pqueue_tag_t * pqueue_tag_init(size_t initial_size)
Create a priority queue sorted by tags.
int(* pqueue_eq_elem_f)(void *next, void *curr)
Callback to determine whether two elements are equivalent.
Definition pqueue_base.h:79
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.
void pqueue_tag_free(pqueue_tag_t *q)
Free all memory used by the queue including elements that are marked dynamic.
void(* pqueue_print_entry_f)(void *a)
Debug callback function to print a entry.
Definition pqueue_base.h:97
int pqueue_tag_insert_tag(pqueue_tag_t *q, tag_t t)
Insert a tag into the queue.
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.
tag_t pqueue_tag_peek_tag(pqueue_tag_t *q)
Return the least tag in the queue or FOREVER if the queue is empty.
tag_t pqueue_tag_pop_tag(pqueue_tag_t *q)
Pop the least-tag element from the queue and return its tag.
pqueue_t pqueue_tag_t
Type of a priority queue sorted by tags.
Definition pqueue_tag.h:89
void pqueue_tag_remove(pqueue_tag_t *q, pqueue_tag_element_t *e)
Remove an item from the queue.
int pqueue_tag_compare(pqueue_pri_t priority1, pqueue_pri_t priority2)
Callback comparison function for the tag-based priority queue.
unsigned long long pqueue_pri_t
Priority data type.
Definition pqueue_base.h:61
pqueue_tag_element_t * pqueue_tag_pop(pqueue_tag_t *q)
Pop the least-tag element from the queue.
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...
Priority Queue function declarations used as a base for Lingua Franca priority queues.
void pqueue_tag_dump(pqueue_tag_t *q)
Dump the queue and it's internal structure.
The priority queue struct.
Definition pqueue_base.h:103
The type for an element in a priority queue that is sorted by tag.
Definition pqueue_tag.h:53
tag_t tag
The tag that determines the element's priority in the queue.
Definition pqueue_tag.h:61
size_t pos
Current position of this element in the priority queue.
Definition pqueue_tag.h:71
int is_dynamic
Flag indicating whether this element should be freed with the queue.
Definition pqueue_tag.h:82
A tag is a time, microstep pair.
Definition tag.h:119
Time and tag definitions and functions for Lingua Franca.