summaryrefslogtreecommitdiffstats
path: root/libavahi-core/prioq.h
blob: 6b5babbe1729c381928e6c0d19efef1e53ab978f (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
34
35
#ifndef fooprioqhfoo
#define fooprioqhfoo

#include <glib.h>

struct _AvahiPrioQueue;
typedef struct _AvahiPrioQueue AvahiPrioQueue;

struct _AvahiPrioQueueNode;
typedef struct _AvahiPrioQueueNode AvahiPrioQueueNode;

struct _AvahiPrioQueue {
    AvahiPrioQueueNode *root, *last;
    
    guint n_nodes;
    gint (*compare) (gconstpointer a, gconstpointer b);
};

struct _AvahiPrioQueueNode {
    AvahiPrioQueue *queue;
    gpointer data;
    guint x, y;

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

AvahiPrioQueue* avahi_prio_queue_new(gint (*compare) (gconstpointer a, gconstpointer b));
void avahi_prio_queue_free(AvahiPrioQueue *q);

AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, gpointer data);
void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n);

void avahi_prio_queue_shuffle(AvahiPrioQueue *q, AvahiPrioQueueNode *n);

#endif