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