heap.h.3coin4 - Man Page

heap.h

Synopsis

#include <Inventor/C/basic.h>
#include <Inventor/SbString.h>

Typedefs

typedef int cc_heap_compare_cb(void *o1, void *o2)
typedef void cc_heap_print_cb(void *o, SbString &str)
typedef struct cc_heap cc_heap

Functions

cc_heap * cc_heap_construct (unsigned int size, cc_heap_compare_cb *comparecb, SbBool support_remove)
void cc_heap_destruct (cc_heap *h)
void cc_heap_clear (cc_heap *h)
void cc_heap_add (cc_heap *h, void *o)
void * cc_heap_get_top (cc_heap *h)
void * cc_heap_extract_top (cc_heap *h)
int cc_heap_remove (cc_heap *h, void *o)
int cc_heap_update (cc_heap *h, void *o)
unsigned int cc_heap_elements (cc_heap *h)
SbBool cc_heap_empty (cc_heap *h)
void cc_heap_print (cc_heap *h, cc_heap_print_cb *printcb, SbString &str, SbBool printLeveled=FALSE)

Typedef Documentation

int cc_heap_compare_cb

A type definition for heap compare callback function. The heap compare function yields true if the first argument of the call appears before the second in the strict weak ordering relation induced by this type, and false otherwise, i.e. cc_heap_compare_cb(x, x) == false

struct cc_heap cc_heap

A type definition for the cc_heap structure

Function Documentation

cc_heap* cc_heap_construct (unsigned int size, cc_heap_compare_cb * comparecb, SbBool support_remove)

Construct a heap. size is the initial array size.

For a minimum heap comparecb should return 1 if the first element is less than the second, zero if they are equal or the first element is greater than the second. For a maximum heap comparecb should return 1 if the first element is greater than the second, zero if they are equal or the first element is less than the second.

support_remove specifies if the heap should support removal of elements (other than the top element) after they are added; this requires use of a hash table to be efficent, but as a slight runtime overhead will be incurred for the add and extract_top functions the support can be disabled if you don't need it.

void cc_heap_destruct (cc_heap * h)

Destruct the heap h.

void cc_heap_clear (cc_heap * h)

Clear/remove all elements in the heap h.

void cc_heap_add (cc_heap * h, void * o)

Add the element o to the heap h.

void* cc_heap_get_top (cc_heap * h)

Returns the top element from the heap h. If the heap is empty, NULL is returned.

void* cc_heap_extract_top (cc_heap * h)

Returns and removes the top element from the heap h. If the heap is empty, NULL is returned.

int cc_heap_remove (cc_heap * h, void * o)

Remove o from the heap h; if present TRUE is returned, otherwise FALSE. Please note that the heap must have been created with support_remove.

int cc_heap_update (cc_heap * h, void * o)

Updates the heap h for new value of existent key o; if key is present TRUE is returned, otherwise FALSE.

unsigned int cc_heap_elements (cc_heap * h)

Returns the number of elements in the heap h.

SbBool cc_heap_empty (cc_heap * h)

Returns TRUE of the heap h is empty; otherwise FALSE.

void cc_heap_print (cc_heap * h, cc_heap_print_cb * printcb, SbString & str, SbBool printLeveled)

Print heap h using a specified callback printcb.

Author

Generated automatically by Doxygen for Coin from the source code.

Info

Wed Jul 21 2021 Version 4.0.0 Coin