cp_heap

Section: libcprops - cp_heap (3)
Updated: JULY 2006
Index Return to Main Contents [view source]
 

NAME

cp_heap - a heap implementation

 

DESCRIPTION

cp_heap is a general purpose heap implementation.

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.

 

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_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)


 

Index

NAME
DESCRIPTION
INTERFACE
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 10:58:19 GMT, July 29, 2006
SourceForge.net Logo