libdict
Data Structure C Library
Loading...
Searching...
No Matches
hb_tree.c File Reference
#include "hb_tree.h"
#include "dict_private.h"
#include "tree_common.h"
Include dependency graph for hb_tree.c:

Go to the source code of this file.

Data Structures

struct  hb_node
 
struct  hb_tree
 
struct  hb_itor
 

Macros

#define BAL_MASK   ((intptr_t)3)
 
#define PARENT(node)
 
#define BAL_POS(node)
 
#define BAL_NEG(node)
 

Typedefs

typedef struct hb_node hb_node
 

Functions

hb_treehb_tree_new (dict_compare_func cmp_func)
 
dicthb_dict_new (dict_compare_func cmp_func)
 
size_t hb_tree_free (hb_tree *tree, dict_delete_func delete_func)
 
size_t hb_tree_clear (hb_tree *tree, dict_delete_func delete_func)
 
dict_insert_result hb_tree_insert (hb_tree *tree, void *key)
 
void ** hb_tree_search (hb_tree *tree, const void *key)
 
void ** hb_tree_search_le (hb_tree *tree, const void *key)
 
void ** hb_tree_search_lt (hb_tree *tree, const void *key)
 
void ** hb_tree_search_ge (hb_tree *tree, const void *key)
 
void ** hb_tree_search_gt (hb_tree *tree, const void *key)
 
dict_remove_result hb_tree_remove (hb_tree *tree, const void *key)
 
size_t hb_tree_traverse (hb_tree *tree, dict_visit_func visit, void *user_data)
 
bool hb_tree_select (hb_tree *tree, size_t n, const void **key, void **datum)
 
size_t hb_tree_count (const hb_tree *tree)
 
size_t hb_tree_min_path_length (const hb_tree *tree)
 
size_t hb_tree_max_path_length (const hb_tree *tree)
 
size_t hb_tree_total_path_length (const hb_tree *tree)
 
bool hb_tree_verify (const hb_tree *tree)
 
hb_itorhb_itor_new (hb_tree *tree)
 
dict_itorhb_dict_itor_new (hb_tree *tree)
 
void hb_itor_free (hb_itor *itor)
 
bool hb_itor_valid (const hb_itor *itor)
 
void hb_itor_invalidate (hb_itor *itor)
 
bool hb_itor_next (hb_itor *itor)
 
bool hb_itor_prev (hb_itor *itor)
 
bool hb_itor_nextn (hb_itor *itor, size_t count)
 
bool hb_itor_prevn (hb_itor *itor, size_t count)
 
bool hb_itor_first (hb_itor *itor)
 
bool hb_itor_last (hb_itor *itor)
 
bool hb_itor_search (hb_itor *itor, const void *key)
 
bool hb_itor_search_le (hb_itor *itor, const void *key)
 
bool hb_itor_search_lt (hb_itor *itor, const void *key)
 
bool hb_itor_search_ge (hb_itor *itor, const void *key)
 
bool hb_itor_search_gt (hb_itor *itor, const void *key)
 
int hb_itor_compare (const hb_itor *i1, const hb_itor *i2)
 
const void * hb_itor_key (const hb_itor *itor)
 
void ** hb_itor_datum (hb_itor *itor)
 
bool hb_itor_remove (hb_itor *itor)
 

Macro Definition Documentation

◆ BAL_MASK

#define BAL_MASK   ((intptr_t)3)

Definition at line 46 of file hb_tree.c.

◆ BAL_NEG

#define BAL_NEG ( node)
Value:
((node)->bal & 2)

Definition at line 49 of file hb_tree.c.

◆ BAL_POS

#define BAL_POS ( node)
Value:
((node)->bal & 1)

Definition at line 48 of file hb_tree.c.

◆ PARENT

#define PARENT ( node)
Value:
((hb_node*) ((node)->bal & ~BAL_MASK))
#define BAL_MASK
Definition hb_tree.c:46

Definition at line 47 of file hb_tree.c.

Typedef Documentation

◆ hb_node

typedef struct hb_node hb_node

Definition at line 33 of file hb_tree.c.

Function Documentation

◆ hb_dict_itor_new()

dict_itor * hb_dict_itor_new ( hb_tree * tree)

Definition at line 603 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_dict_new()

dict * hb_dict_new ( dict_compare_func cmp_func)

Definition at line 121 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_compare()

int hb_itor_compare ( const hb_itor * i1,
const hb_itor * i2 )

Definition at line 651 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_datum()

void ** hb_itor_datum ( hb_itor * itor)

Definition at line 653 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_first()

bool hb_itor_first ( hb_itor * itor)

Definition at line 644 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_free()

void hb_itor_free ( hb_itor * itor)

Definition at line 616 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_invalidate()

void hb_itor_invalidate ( hb_itor * itor)

Definition at line 618 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_key()

const void * hb_itor_key ( const hb_itor * itor)

Definition at line 652 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_last()

bool hb_itor_last ( hb_itor * itor)

Definition at line 645 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_new()

hb_itor * hb_itor_new ( hb_tree * tree)

Definition at line 592 of file hb_tree.c.

◆ hb_itor_next()

bool hb_itor_next ( hb_itor * itor)

Definition at line 620 of file hb_tree.c.

◆ hb_itor_nextn()

bool hb_itor_nextn ( hb_itor * itor,
size_t count )

Definition at line 632 of file hb_tree.c.

◆ hb_itor_prev()

bool hb_itor_prev ( hb_itor * itor)

Definition at line 626 of file hb_tree.c.

◆ hb_itor_prevn()

bool hb_itor_prevn ( hb_itor * itor,
size_t count )

Definition at line 638 of file hb_tree.c.

◆ hb_itor_remove()

bool hb_itor_remove ( hb_itor * itor)

Definition at line 656 of file hb_tree.c.

◆ hb_itor_search()

bool hb_itor_search ( hb_itor * itor,
const void * key )

Definition at line 646 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_search_ge()

bool hb_itor_search_ge ( hb_itor * itor,
const void * key )

Definition at line 649 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_search_gt()

bool hb_itor_search_gt ( hb_itor * itor,
const void * key )

Definition at line 650 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_search_le()

bool hb_itor_search_le ( hb_itor * itor,
const void * key )

Definition at line 647 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_search_lt()

bool hb_itor_search_lt ( hb_itor * itor,
const void * key )

Definition at line 648 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_itor_valid()

bool hb_itor_valid ( const hb_itor * itor)

Definition at line 617 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_clear()

size_t hb_tree_clear ( hb_tree * tree,
dict_delete_func delete_func )

Definition at line 142 of file hb_tree.c.

◆ hb_tree_count()

size_t hb_tree_count ( const hb_tree * tree)

Definition at line 494 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_free()

size_t hb_tree_free ( hb_tree * tree,
dict_delete_func delete_func )

Definition at line 135 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_insert()

dict_insert_result hb_tree_insert ( hb_tree * tree,
void * key )

Definition at line 278 of file hb_tree.c.

◆ hb_tree_max_path_length()

size_t hb_tree_max_path_length ( const hb_tree * tree)

Definition at line 496 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_min_path_length()

size_t hb_tree_min_path_length ( const hb_tree * tree)

Definition at line 495 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_new()

hb_tree * hb_tree_new ( dict_compare_func cmp_func)

Definition at line 106 of file hb_tree.c.

◆ hb_tree_remove()

dict_remove_result hb_tree_remove ( hb_tree * tree,
const void * key )

Definition at line 450 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_search()

void ** hb_tree_search ( hb_tree * tree,
const void * key )

Definition at line 356 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_search_ge()

void ** hb_tree_search_ge ( hb_tree * tree,
const void * key )

Definition at line 359 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_search_gt()

void ** hb_tree_search_gt ( hb_tree * tree,
const void * key )

Definition at line 360 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_search_le()

void ** hb_tree_search_le ( hb_tree * tree,
const void * key )

Definition at line 357 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_search_lt()

void ** hb_tree_search_lt ( hb_tree * tree,
const void * key )

Definition at line 358 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_select()

bool hb_tree_select ( hb_tree * tree,
size_t n,
const void ** key,
void ** datum )

Definition at line 467 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_total_path_length()

size_t hb_tree_total_path_length ( const hb_tree * tree)

Definition at line 497 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_traverse()

size_t hb_tree_traverse ( hb_tree * tree,
dict_visit_func visit,
void * user_data )

Definition at line 461 of file hb_tree.c.

Here is the call graph for this function:

◆ hb_tree_verify()

bool hb_tree_verify ( const hb_tree * tree)

Definition at line 583 of file hb_tree.c.