BRL-CAD
#include "common.h"
#include "bu/defines.h"
#include "bu/magic.h"
#include "bu/bitv.h"
Include dependency graph for redblack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bu_rb_list
 
struct  bu_rb_tree
 
struct  bu_rb_package
 
struct  bu_rb_node
 

Macros

#define rbl_node   rbl_u.rbl_n
 
#define rbl_package   rbl_u.rbl_p
 
#define BU_RB_LIST_NULL   ((struct bu_rb_list *) 0)
 
#define BU_RB_LIST_INIT(_l, _m)
 
#define BU_RB_LIST_INIT_CAPACITY   4
 
#define BU_RB_TREE_NULL   ((struct bu_rb_tree *) 0)
 
#define BU_CK_RB_TREE(_rb)   BU_CKMAG(_rb, BU_RB_TREE_MAGIC, "bu_rb_tree")
 
#define BU_RB_TREE_INIT(_rb)
 
#define BU_RB_TREE_INIT_ZERO
 
#define BU_RB_TREE_IS_INITIALIZED(_rb)   (((struct bu_rb_tree *)(_rb) != BU_RB_TREE_NULL) && LIKELY((_rb)->rbt_magic == BU_RB_TREE_MAGIC))
 
#define BU_RB_DEBUG_INSERT   0x00000001
 
#define BU_RB_DEBUG_UNIQ   0x00000002
 
#define BU_RB_DEBUG_ROTATE   0x00000004
 
#define BU_RB_DEBUG_OS   0x00000008
 
#define BU_RB_DEBUG_DELETE   0x00000010
 
#define BU_RB_PKG_NULL   ((struct bu_rb_package *) 0)
 
#define BU_RB_NODE_NULL   ((struct bu_rb_node *) 0)
 
#define SENSE_MIN   0
 
#define SENSE_MAX   1
 
#define bu_rb_min(t, o)   bu_rb_extreme((t), (o), SENSE_MIN)
 
#define bu_rb_max(t, o)   bu_rb_extreme((t), (o), SENSE_MAX)
 
#define bu_rb_pred(t, o)   bu_rb_neighbor((t), (o), SENSE_MIN)
 
#define bu_rb_succ(t, o)   bu_rb_neighbor((t), (o), SENSE_MAX)
 
#define bu_rb_delete1(t)   bu_rb_delete((t), 0)
 
#define bu_rb_curr1(t)   bu_rb_curr((t), 0)
 
#define BU_RB_RETAIN_DATA   ((void (*)(void *data)) 0)
 
#define bu_rb_free1(t, f)
 
#define bu_rb_is_uniq1(t)   bu_rb_is_uniq((t), 0)
 
#define bu_rb_uniq_on1(t)   bu_rb_uniq_on((t), 0)
 
#define bu_rb_uniq_off1(t)   bu_rb_uniq_off((t), 0)
 
#define bu_rb_rank1(t)   bu_rb_rank1((t), 0)
 
#define bu_rb_select1(t, k)   bu_rb_select((t), 0, (k))
 
#define bu_rb_search1(t, d)   bu_rb_search((t), 0, (d))
 
#define bu_rb_walk1(t, v, d)   bu_rb_walk((t), 0, (v), (d))
 
#define BU_RB_WALK_FUNC_CAST_AS_FUNC_ARG(_func)   ((void (*)(void))_func)
 
#define BU_RB_WALK_FUNC_CAST_AS_NODE_FUNC(_func)   ((void (*)(struct bu_rb_node *, int))_func)
 
#define BU_RB_WALK_FUNC_CAST_AS_DATA_FUNC(_func)   ((void (*)(void *, int))_func)
 
#define BU_RB_WALK_FUNC_CAST_AS_FUNC_FUNC(_func)   ((void (*)(struct bu_rb_node *, int, void (*)(void), int))_func)
 
#define BU_RB_WALK_FUNC_NODE_DECL(_func)   void (*_func)(struct bu_rb_node *, int)
 
#define BU_RB_WALK_FUNC_DATA_DECL(_func)   void (*_func)(void *, int)
 
#define BU_RB_WALK_FUNC_FUNC_DECL(_func)   void (*_func)(struct bu_rb_node *, int, void (*)(void), int)
 

Typedefs

typedef struct bu_rb_tree bu_rb_tree_t
 
typedef int(* bu_rb_cmp_t) (const void *, const void *)
 Routines to create a red-black tree. More...
 

Enumerations

enum  BU_RB_WALK_ORDER { BU_RB_WALK_PREORDER , BU_RB_WALK_INORDER , BU_RB_WALK_POSTORDER }
 

Functions

struct bu_rb_treebu_rb_create (const char *description, int nm_orders, bu_rb_cmp_t *compare_funcs)
 
void bu_rb_delete (struct bu_rb_tree *tree, int order)
 Routines to delete a node from a red-black tree. More...
 
void bu_rb_diagnose_tree (struct bu_rb_tree *tree, int order, int trav_type)
 Diagnostic routines for red-black tree maintenance. More...
 
void bu_rb_summarize_tree (struct bu_rb_tree *tree)
 
void * bu_rb_extreme (struct bu_rb_tree *tree, int order, int sense)
 Routines to extract mins, maxes, adjacent, and current nodes from a red-black tree. More...
 
void * bu_rb_neighbor (struct bu_rb_tree *tree, int order, int sense)
 
void * bu_rb_curr (struct bu_rb_tree *tree, int order)
 
void bu_rb_free (struct bu_rb_tree *tree, void(*free_data)(void *data))
 Routines to free a red-black tree. More...
 
int bu_rb_insert (struct bu_rb_tree *tree, void *data)
 Routines to insert into a red-black tree. More...
 
int bu_rb_is_uniq (struct bu_rb_tree *tree, int order)
 
void bu_rb_set_uniqv (struct bu_rb_tree *tree, bitv_t vec)
 
void bu_rb_uniq_all_off (struct bu_rb_tree *tree)
 
void bu_rb_uniq_all_on (struct bu_rb_tree *tree)
 
int bu_rb_uniq_on (struct bu_rb_tree *tree, int order)
 
int bu_rb_uniq_off (struct bu_rb_tree *tree, int order)
 
int bu_rb_rank (struct bu_rb_tree *tree, int order)
 Routines to support order-statistic operations for a red-black tree. More...
 
void * bu_rb_select (struct bu_rb_tree *tree, int order, int k)
 
void * bu_rb_search (struct bu_rb_tree *tree, int order, void *data)
 Routines to search for a node in a red-black tree. More...
 
void bu_rb_walk (struct bu_rb_tree *tree, int order, void(*visit)(void), int trav_type)
 Routines for traversal of red-black trees. More...