]> git.meshlink.io Git - catta/blob - prioq.h
* add todo list
[catta] / prioq.h
1 #ifndef fooprioqhfoo
2 #define fooprioqhfoo
3
4 #include <glib.h>
5
6 struct _flxPrioQueue;
7 typedef struct _flxPrioQueue flxPrioQueue;
8
9 struct _flxPrioQueueNode;
10 typedef struct _flxPrioQueueNode flxPrioQueueNode;
11
12 struct _flxPrioQueue {
13     flxPrioQueueNode *root, *last;
14     
15     guint n_nodes;
16     gint (*compare) (gconstpointer a, gconstpointer b);
17 };
18
19 struct _flxPrioQueueNode {
20     flxPrioQueue *queue;
21     gpointer data;
22     guint x, y;
23
24     flxPrioQueueNode *left, *right, *parent, *next, *prev;
25 };
26
27 flxPrioQueue* flx_prio_queue_new(gint (*compare) (gconstpointer a, gconstpointer b));
28 void flx_prio_queue_free(flxPrioQueue *q);
29
30 flxPrioQueueNode* flx_prio_queue_put(flxPrioQueue *q, gpointer data);
31 void flx_prio_queue_remove(flxPrioQueue *q, flxPrioQueueNode *n);
32
33 void flx_prio_queue_shuffle(flxPrioQueue *q, flxPrioQueueNode *n);
34
35 #endif