Home | History | Annotate | Line # | Download | only in isc
      1  1.1.1.4  christos /*	$NetBSD: heap.h,v 1.1.1.4 2009/04/12 16:35:44 christos Exp $	*/
      2      1.1  christos 
      3      1.1  christos /*
      4      1.1  christos  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
      5      1.1  christos  * Copyright (c) 1997,1999 by Internet Software Consortium.
      6      1.1  christos  *
      7      1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      8      1.1  christos  * purpose with or without fee is hereby granted, provided that the above
      9      1.1  christos  * copyright notice and this permission notice appear in all copies.
     10      1.1  christos  *
     11      1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
     12      1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13      1.1  christos  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
     14      1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15      1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16      1.1  christos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     17      1.1  christos  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18      1.1  christos  */
     19      1.1  christos 
     20      1.1  christos typedef int (*heap_higher_priority_func)(void *, void *);
     21      1.1  christos typedef void (*heap_index_func)(void *, int);
     22      1.1  christos typedef void (*heap_for_each_func)(void *, void *);
     23      1.1  christos 
     24      1.1  christos typedef struct heap_context {
     25      1.1  christos 	int array_size;
     26      1.1  christos 	int array_size_increment;
     27      1.1  christos 	int heap_size;
     28      1.1  christos 	void **heap;
     29      1.1  christos 	heap_higher_priority_func higher_priority;
     30      1.1  christos 	heap_index_func index;
     31      1.1  christos } *heap_context;
     32      1.1  christos 
     33      1.1  christos #define heap_new	__heap_new
     34      1.1  christos #define heap_free	__heap_free
     35      1.1  christos #define heap_insert	__heap_insert
     36      1.1  christos #define heap_delete	__heap_delete
     37      1.1  christos #define heap_increased	__heap_increased
     38      1.1  christos #define heap_decreased	__heap_decreased
     39      1.1  christos #define heap_element	__heap_element
     40      1.1  christos #define heap_for_each	__heap_for_each
     41      1.1  christos 
     42      1.1  christos heap_context	heap_new(heap_higher_priority_func, heap_index_func, int);
     43      1.1  christos int		heap_free(heap_context);
     44      1.1  christos int		heap_insert(heap_context, void *);
     45      1.1  christos int		heap_delete(heap_context, int);
     46      1.1  christos int		heap_increased(heap_context, int);
     47      1.1  christos int		heap_decreased(heap_context, int);
     48      1.1  christos void *		heap_element(heap_context, int);
     49      1.1  christos int		heap_for_each(heap_context, heap_for_each_func, void *);
     50  1.1.1.2  christos 
     51  1.1.1.2  christos /*! \file */
     52