libcstl
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
heap.h File Reference

Go to the source code of this file.

Data Structures

struct  cstl_heap_node
 Node to anchor an element within a heap. More...
 
struct  cstl_heap
 Heap object. More...
 

Macros

#define CSTL_HEAP_INITIALIZER(TYPE, MEMB, CMP, PRIV)
 Constant initialization of a heap object.
 
#define DECLARE_CSTL_HEAP(NAME, TYPE, MEMB, CMP, PRIV)
 (Statically) declare and initialize a heap
 

Functions

static void cstl_heap_init (struct cstl_heap *const h, cstl_compare_func_t *const cmp, void *const priv, const size_t off)
 Initialize a heap object.
 
static size_t cstl_heap_size (const struct cstl_heap *const h)
 Get the number of objects in the heap.
 
void cstl_heap_push (struct cstl_heap *h, void *e)
 Insert a new object into the heap.
 
const void * cstl_heap_get (const struct cstl_heap *h)
 Get a pointer to the object at the top of the heap.
 
void * cstl_heap_pop (struct cstl_heap *h)
 Remove the highest valued element from the heap.
 
static void cstl_heap_clear (struct cstl_heap *const h, cstl_xtor_func_t *const clr)
 Remove all elements from the heap.
 
static void cstl_heap_swap (struct cstl_heap *const a, struct cstl_heap *const b)
 Swap the heap objects at the two given locations.