cp_heap(3) - Linux man page

Name

cp_heap - a heap implementation

Description

cp_heap is a general purpose heap implementation.

A heap is created with cp_heap_create(3) or cp_heap_create_by_option(3) and deallocated with cp_heap_destroy(3). After creation behavior may be changed by calling cp_heap_set_mode(3) and cp_heap_unset_mode(3) to set and unset mode bits. Items may be pushed on the heap with cp_heap_push(3). cp_heap_pop(3) returns the minimum value in the heap, as determined using the compare function provided at creation time. The cp_hash_compare_* functions defined in <cprops/hashtable.h> may be used for primitive types and null terminated strings. For more details see the documentation for specific functions.

Interface

the following is a summary of functions provided by <cprops/heap.h>.

cp_heap *cp_heap_create(cp_compare_fn cmp);
cp_heap *

cp_heap_create_by_option(int mode,

int size_hint, cp_compare_fn compare_fn, cp_copy copy, cp_destructor_fn dtr);

void cp_heap_destroy(cp_heap *heap);

void *cp_heap_push(cp_heap *heap, void *item);
void *cp_heap_pop(cp_heap *
heap);

void *cp_heap_peek(cp_heap *heap);
void cp_heap_callback(cp_heap *
heap, cp_callback_fn cb, void *prm);

int cp_heap_count(cp_heap *heap);
int cp_heap_size(cp_heap *
heap);
int cp_heap_contract(cp_heap *
heap);

int cp_heap_get_mode(cp_heap *heap);
void cp_heap_set_mode(cp_heap *
heap, int mode);
void cp_heap_unset_mode(cp_heap *
heap, int mode);

int cp_heap_lock(cp_heap *heap, int type);
int cp_heap_unlock(cp_heap *
heap);

Author

cp_heap is based on libheap by Kyle Wheeler and Branden Moore.

See Also

cp_heap_create(3), cp_heap_push(3), cp_heap_lock(3), cp_heap_set_mode(3), cp_hashtable(3), cprops(3)