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