25 #ifndef __AST_HEAP_H__
26 #define __AST_HEAP_H__
100 #define ast_heap_create(init_height, cmp_fn, index_offset) \
101 _ast_heap_create(init_height, cmp_fn, index_offset, __FILE__, __LINE__, __PRETTY_FUNCTION__)
125 #define ast_heap_push(h, elm) \
126 _ast_heap_push(h, elm, __FILE__, __LINE__, __PRETTY_FUNCTION__)
247 #define ast_heap_wrlock(h) __ast_heap_wrlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
248 #define ast_heap_rdlock(h) __ast_heap_rdlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
249 #define ast_heap_unlock(h) __ast_heap_unlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
int ast_heap_verify(struct ast_heap *h)
Verify that a heap has been properly constructed.
int(* ast_heap_cmp_fn)(void *elm1, void *elm2)
Function type for comparing nodes in a heap.
struct ast_heap * ast_heap_destroy(struct ast_heap *h)
Destroy a max heap.
struct ast_heap * _ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn, ssize_t index_offset, const char *file, int lineno, const char *func)
int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line)
Read-Lock a heap.
void * ast_heap_peek(struct ast_heap *h, unsigned int index)
Peek at an element on a heap.
int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line)
Unlock a heap.
size_t ast_heap_size(struct ast_heap *h)
Get the current size of a heap.
void * ast_heap_remove(struct ast_heap *h, void *elm)
Remove a specific element from a heap.
int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line)
Write-Lock a heap.
void * ast_heap_pop(struct ast_heap *h)
Pop the max element off of the heap.
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func)