Skip to content

File binaryheap.h

FileList > base > binaryheap.h

Go to the source code of this file

  • #include "config.h"
  • #include "thread_compat.hpp"

Classes

Type Name
struct binary_heap

Public Types

Type Name
typedef void * BH_CMP_ARG
enum BH_CMP_RESULT
enum BH_HEAP_STATE
enum BH_TRY_INSERT_RESULT
typedef struct binary_heap BINARY_HEAP
typedef BH_CMP_RESULT(* bh_key_comparator

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)

Macros

Type Name
define BH_ELEMENT (heap, i) ((([**char**](broker__monitor_8c.md#function-timeout) \*) (heap)->members) + (heap)->elem\_size \* ([**i**](dynamic__load_8c.md#variable-i)))
define BH_ROOT (heap) ((heap)->members)

Public Types Documentation

typedef BH_CMP_ARG

typedef void* BH_CMP_ARG;

enum BH_CMP_RESULT

enum BH_CMP_RESULT {
    BH_CMP_ERROR = -2,
    BH_LT = -1,
    BH_EQ = 0,
    BH_GT = 1
};

enum BH_HEAP_STATE

enum BH_HEAP_STATE {
    BH_HEAP_INCONSISTENT,
    BH_HEAP_CONSISTENT,
    BH_SORTED_ARRAY
};

enum BH_TRY_INSERT_RESULT

enum BH_TRY_INSERT_RESULT {
    BH_TRY_INSERT_REJECTED,
    BH_TRY_INSERT_ACCEPTED,
    BH_TRY_INSERT_REPLACED
};

typedef BINARY_HEAP

typedef struct binary_heap BINARY_HEAP;

typedef bh_key_comparator

typedef BH_CMP_RESULT(* bh_key_comparator) (const void *left, const void *right, BH_CMP_ARG arg);

Public Functions Documentation

function bh_add

int bh_add (
    BINARY_HEAP * heap,
    void * elem
) 

function bh_build_heap

void bh_build_heap (
    BINARY_HEAP * 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

void bh_destroy (
    THREAD_ENTRY * thread_p,
    BINARY_HEAP * heap
) 

function bh_down_heap

void bh_down_heap (
    BINARY_HEAP * heap,
    int index
) 

function bh_element_at

void bh_element_at (
    BINARY_HEAP * heap,
    int index,
    void * elem
) 

function bh_extract_max

bool bh_extract_max (
    BINARY_HEAP * heap,
    void * extract_elem
) 

function bh_insert

int bh_insert (
    BINARY_HEAP * heap,
    void * elem
) 

function bh_is_consistent

bool bh_is_consistent (
    BINARY_HEAP * heap
) 

function bh_is_full

bool bh_is_full (
    BINARY_HEAP * heap
) 

function bh_peek_max

bool bh_peek_max (
    BINARY_HEAP * heap,
    void * peek_elem
) 

function bh_tests_consistent

bool bh_tests_consistent (
    BINARY_HEAP * heap
) 

function bh_to_sorted_array

void bh_to_sorted_array (
    BINARY_HEAP * heap
) 

function bh_try_insert

BH_TRY_INSERT_RESULT bh_try_insert (
    BINARY_HEAP * heap,
    void * elem,
    void * replaced
) 

Macro Definition Documentation

define BH_ELEMENT

#define BH_ELEMENT (
    heap,
    i
) `((( char *) (heap)->members) + (heap)->elem_size * ( i ))`

define BH_ROOT

#define BH_ROOT (
    heap
) `((heap)->members)`


The documentation for this class was generated from the following file cubrid/src/base/binaryheap.h