blob: d19c46de771324ad3b3ae02b001e4dc4314062ea [file] [log] [blame]
hasso6708fa32004-05-18 18:46:54 +00001/* Priority queue functions.
2 Copyright (C) 2003 Yasuhiro Ohara
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation; either version 2, or (at your
9option) any later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21#ifndef _ZEBRA_PQUEUE_H
22#define _ZEBRA_PQUEUE_H
23
24struct pqueue
25{
26 void **array;
27 int array_size;
28 int size;
29
30 int (*cmp) (void *, void *);
hassoc3c07f22005-02-21 18:17:52 +000031 void (*update) (void * node, int actual_position);
hasso6708fa32004-05-18 18:46:54 +000032};
33
34#define PQUEUE_INIT_ARRAYSIZE 32
35
36struct pqueue *pqueue_create ();
37void pqueue_delete (struct pqueue *queue);
38
39void pqueue_enqueue (void *data, struct pqueue *queue);
40void *pqueue_dequeue (struct pqueue *queue);
41
hassoc3c07f22005-02-21 18:17:52 +000042void trickle_down (int index, struct pqueue *queue);
43
hasso6708fa32004-05-18 18:46:54 +000044#endif /* _ZEBRA_PQUEUE_H */