[view source]
A heap is created with cp_heap_create_by_option(3) and deallocated with cp_heap_destroy(3). After creation behavior may be changed by calling 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.
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_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);
This document was created by
man2html,
using the manual pages. Time: 10:58:19 GMT, July 29, 2006 |