Simple data structures / objects in plain C Snapshot
Classes | Typedefs | Functions
heap.h File Reference
#include <cutils/base.h>

Go to the source code of this file.

Classes

struct  HEAP

Typedefs

typedef int(* HEAP_compare )(void *lhs, void *rhs, size_t elmsize)
typedef int(* HEAP_VISITOR )(int index, void *elm, size_t elmsize, void *context)

Functions

M_INLINE int HEAP_init (HEAP *heap, size_t elmcount, size_t elmsize, HEAP_compare compare_func)
M_INLINE void HEAP_free (HEAP *heap)
 free all memory used by the heap (object destructor). heap (in) the object.
M_INLINE size_t HEAP_size (HEAP *heap)
M_INLINE size_t HEAP_maxsize (HEAP *heap)
M_INLINE size_t HEAP_elmsize (HEAP *heap)
M_INLINE void * HEAP_top (HEAP *heap)
 returns pointer to the top element of the heap.
M_INLINE void * HEAP_get_at (HEAP *heap, int index)
int HEAP_pop (HEAP *heap)
 remove the top element from the heap
int HEAP_push (HEAP *heap, void *element, size_t elmsize)
 insert a new element into the heap
int HEAP_check (HEAP *heap)
 check consistency of heap object.
void HEAP_foreach_sorted (HEAP *heap, HEAP_VISITOR eval, void *context)
M_INLINE void HEAP_foreach (HEAP *heap, HEAP_VISITOR eval, void *context)
M_INLINE int HEAP_findif (HEAP *heap, HEAP_VISITOR eval, void *context, int32_t *retval)

Typedef Documentation

typedef int(* HEAP_compare)(void *lhs, void *rhs, size_t elmsize)

Definition at line 13 of file heap.h.