File binaryheap.c¶
FileList > base > binaryheap.c
Go to the source code of this file
#include <stdlib.h>#include <assert.h>#include "binaryheap.h"#include "memory_alloc.h"#include "error_manager.h"#include "memory_wrapper.hpp"
Public Functions¶
| Type | Name |
|---|---|
| int | bh_add (BINARY_HEAP * heap, void * elem) |
| void | bh_build_heap (BINARY_HEAP * heap) |
| BINARY_HEAP * | bh_create (THREAD_ENTRY * thread_p, int max_capacity, int elem_size, bh_key_comparator cmp_func, BH_CMP_ARG cmp_arg) |
| void | bh_destroy (THREAD_ENTRY * thread_p, BINARY_HEAP * heap) |
| void | bh_down_heap (BINARY_HEAP * heap, int index) |
| void | bh_element_at (BINARY_HEAP * heap, int index, void * elem) |
| bool | bh_extract_max (BINARY_HEAP * heap, void * extract_elem) |
| int | bh_insert (BINARY_HEAP * heap, void * elem) |
| bool | bh_is_consistent (BINARY_HEAP * heap) |
| bool | bh_is_full (BINARY_HEAP * heap) |
| bool | bh_peek_max (BINARY_HEAP * heap, void * peek_elem) |
| bool | bh_tests_consistent (BINARY_HEAP * heap) |
| void | bh_to_sorted_array (BINARY_HEAP * heap) |
| BH_TRY_INSERT_RESULT | bh_try_insert (BINARY_HEAP * heap, void * elem, void * replaced) |
Public Static Functions¶
| Type | Name |
|---|---|
| void | bh_replace_max (BINARY_HEAP * heap, void * elem) |
| void | bh_up_heap (BINARY_HEAP * heap, int index) |
Macros¶
| Type | Name |
|---|---|
| define | BH_CMP (heap, l, r) (heap->cmp\_func ([**BH\_ELEMENT**](binaryheap_8h.md#define-bh_element) (heap, l), [**BH\_ELEMENT**](binaryheap_8h.md#define-bh_element) (heap, r), heap->cmp\_arg)) |
| define | BH_ELEMENT_COPY (heap, dest, src) ([**memcpy**](broker__monitor_8c.md#function-timeout) (dest, src, (heap)->elem\_size)) |
| define | BH_LEFT (i) (2\*([**i**](dynamic__load_8c.md#variable-i)) + 1) |
| define | BH_PARENT (i) (([**i**](dynamic__load_8c.md#variable-i) - 1)/2) |
| define | BH_RIGHT (i) (2\*([**i**](dynamic__load_8c.md#variable-i))+2) |
| define | BH_SWAP (heap, left, right) /* multi line expression */ |
Public Functions Documentation¶
function bh_add¶
function bh_build_heap¶
function bh_create¶
BINARY_HEAP * bh_create (
THREAD_ENTRY * thread_p,
int max_capacity,
int elem_size,
bh_key_comparator cmp_func,
BH_CMP_ARG cmp_arg
)
function bh_destroy¶
function bh_down_heap¶
function bh_element_at¶
function bh_extract_max¶
function bh_insert¶
function bh_is_consistent¶
function bh_is_full¶
function bh_peek_max¶
function bh_tests_consistent¶
function bh_to_sorted_array¶
function bh_try_insert¶
Public Static Functions Documentation¶
function bh_replace_max¶
function bh_up_heap¶
Macro Definition Documentation¶
define BH_CMP¶
#define BH_CMP (
heap,
l,
r
) `(heap->cmp_func ( BH_ELEMENT (heap, l), BH_ELEMENT (heap, r), heap->cmp_arg))`
define BH_ELEMENT_COPY¶
define BH_LEFT¶
define BH_PARENT¶
define BH_RIGHT¶
define BH_SWAP¶
The documentation for this class was generated from the following file cubrid/src/base/binaryheap.c