summaryrefslogtreecommitdiffstats
path: root/prioq.h
blob: e1b87966bfb303fb0046943378f07217dbf0293e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef fooprioqhfoo
#define fooprioqhfoo

#include <glib.h>

struct _flxPrioQueue;
typedef struct _flxPrioQueue flxPrioQueue;

struct _flxPrioQueueNode;
typedef struct _flxPrioQueueNode flxPrioQueueNode;

struct _flxPrioQueue {
    flxPrioQueueNode *root, *last;
    
    guint n_nodes;
    gint (*compare) (gpointer a, gpointer b);
};

struct _flxPrioQueueNode {
    flxPrioQueue *queue;
    gpointer data;
    guint x, y;

    flxPrioQueueNode *left, *right, *parent, *next, *prev;
};

flxPrioQueue* flx_prio_queue_new(gint (*compare) (gpointer a, gpointer b));
void flx_prio_queue_free(flxPrioQueue *q);

flxPrioQueueNode* flx_prio_queue_put(flxPrioQueue *q, gpointer data);
void flx_prio_queue_remove(flxPrioQueue *q, flxPrioQueueNode *n);

#endif