ISC DHCP 4.4.3-P1
A reference DHCPv4 and DHCPv6 implementation
 
Loading...
Searching...
No Matches
heap.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2017 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1997-2003 Internet Software Consortium.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
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.
16 */
17
18/* $Id: heap.h,v 1.3 2007/05/19 19:16:25 dhankins Exp $ */
19
20#ifndef ISC_HEAP_H
21#define ISC_HEAP_H 1
22
24
25/*%
26 * The comparision function returns ISC_TRUE if the first argument has
27 * higher priority than the second argument, and ISC_FALSE otherwise.
28 */
29typedef isc_boolean_t (*isc_heapcompare_t)(void *, void *);
30
31/*%
32 * The index function allows the client of the heap to receive a callback
33 * when an item's index number changes. This allows it to maintain
34 * sync with its external state, but still delete itself, since deletions
35 * from the heap require the index be provided.
36 */
37typedef void (*isc_heapindex_t)(void *, unsigned int);
38
39/*%
40 * The heapaction function is used when iterating over the heap.
41 *
42 * NOTE: The heap structure CANNOT BE MODIFIED during the call to
43 * isc_heap_foreach().
44 */
45typedef void (*isc_heapaction_t)(void *, void *);
46
47typedef struct isc_heap isc_heap_t;
48
49isc_result_t
51 isc_heapindex_t index, unsigned int size_increment,
52 isc_heap_t **heapp);
77
78void
86
87isc_result_t
88isc_heap_insert(isc_heap_t *heap, void *elt);
95
96void
97isc_heap_delete(isc_heap_t *heap, unsigned int index);
106
107void
108isc_heap_increased(isc_heap_t *heap, unsigned int index);
118
119void
120isc_heap_decreased(isc_heap_t *heap, unsigned int index);
130
131void *
132isc_heap_element(isc_heap_t *heap, unsigned int index);
144
145void
162
163#endif /* ISC_HEAP_H */
isc_boolean_t
Definition data.h:150
void * isc_heap_element(isc_heap_t *heap, unsigned int index)
Returns the element for a specific element index.
void isc_heap_foreach(isc_heap_t *heap, isc_heapaction_t action, void *uap)
Iterate over the heap, calling an action for each element. The order of iteration is not sorted.
void(* isc_heapindex_t)(void *, unsigned int)
Definition heap.h:37
isc_boolean_t(* isc_heapcompare_t)(void *, void *)
Definition heap.h:29
struct isc_heap isc_heap_t
Definition heap.h:47
void isc_heap_destroy(isc_heap_t **heapp)
Destroys a heap.
isc_result_t isc_heap_insert(isc_heap_t *heap, void *elt)
Inserts a new element into a heap.
void isc_heap_decreased(isc_heap_t *heap, unsigned int index)
Indicates to the heap that an element's priority has decreased. This function MUST be called whenever...
void isc_heap_increased(isc_heap_t *heap, unsigned int index)
Indicates to the heap that an element's priority has increased. This function MUST be called whenever...
isc_result_t isc_heap_create(isc_heapcompare_t compare, isc_heapindex_t index, unsigned int size_increment, isc_heap_t **heapp)
Create a new heap. The heap is implemented using a space-efficient storage method....
void isc_heap_delete(isc_heap_t *heap, unsigned int index)
Deletes an element from a heap, by element index.
void(* isc_heapaction_t)(void *, void *)
Definition heap.h:45
const char int
Definition omapip.h:442