2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1997-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: heap.h,v 1.16.2.1 2004/03/09 06:11:56 marka Exp $ */
24 #include <isc/types.h>
29 * The comparision function returns ISC_TRUE if the first argument has
30 * higher priority than the second argument, and ISC_FALSE otherwise.
32 typedef isc_boolean_t (*isc_heapcompare_t
)(void *, void *);
34 typedef void (*isc_heapindex_t
)(void *, unsigned int);
35 typedef void (*isc_heapaction_t
)(void *, void *);
37 typedef struct isc_heap isc_heap_t
;
39 isc_result_t
isc_heap_create(isc_mem_t
*, isc_heapcompare_t
,
40 isc_heapindex_t
, unsigned int, isc_heap_t
**);
41 void isc_heap_destroy(isc_heap_t
**);
42 isc_result_t
isc_heap_insert(isc_heap_t
*, void *);
43 void isc_heap_delete(isc_heap_t
*, unsigned int);
44 void isc_heap_increased(isc_heap_t
*, unsigned int);
45 void isc_heap_decreased(isc_heap_t
*, unsigned int);
46 void * isc_heap_element(isc_heap_t
*, unsigned int);
47 void isc_heap_foreach(isc_heap_t
*, isc_heapaction_t
, void *);
51 #endif /* ISC_HEAP_H */