commit a8ad2d8a2fba1f8c51095f5ee8a361de130a3ed4 parent 532c126f77f0a35c3fff1bf471f5c02523c9390d Author: Sebastiano Tronto <sebastiano@tronto.net> Date: Tue, 21 Feb 2023 23:51:35 +0100 First draft for priority queue interface Diffstat:
A | PriorityQueue/PriorityQueue.h | | | 18 | ++++++++++++++++++ |
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/PriorityQueue/PriorityQueue.h b/PriorityQueue/PriorityQueue.h @@ -0,0 +1,18 @@ +/* TODO: maybe v1 with exposed priority queue data, then v2 with + just void * to better encapsulate? */ + +typedef void * T; +typedef struct { + int (*priority)(T); + char *ToString(T); +} TDescription; + +typedef struct { + void *data; + TDescription; +} PriorityQueue; + +PriorityQueue *NewPriorityQueue(TDescription); +void Add(PriorityQueue *, T); +T Pop(PriorityQueue *); +void DeletePriorityQueue(PriorityQueue *);