88#define rbl_node rbl_u.rbl_n
89#define rbl_package rbl_u.rbl_p
90#define BU_RB_LIST_NULL ((struct bu_rb_list *) 0)
91#define BU_RB_LIST_INIT(_l, _m) { \
92 (_l).size = (_l).capacity = 0; \
96#define BU_RB_LIST_INIT_CAPACITY 4
134#define BU_RB_TREE_NULL ((struct bu_rb_tree *) 0)
139#define BU_CK_RB_TREE(_rb) BU_CKMAG(_rb, BU_RB_TREE_MAGIC, "bu_rb_tree")
144#define BU_RB_TREE_INIT(_rb) { \
145 (_rb)->rbt_magic = BU_RB_TREE_MAGIC; \
146 (_rb)->rbt_nm_nodes = 0; \
147 (_rb)->rbt_print = NULL; \
148 (_rb)->rbt_debug = 0; \
149 (_rb)->rbt_description = NULL; \
150 (_rb)->rbt_nm_orders = 0; \
151 (_rb)->rbt_compar = NULL; \
152 (_rb)->rbt_root = (_rb)->rbt_unique = (_rb)->rbt_current = NULL; \
153 (_rb)->rbt_nodes.rbl_u.rbl_n = (_rb)->rbt_nodes.rbl_u.rbl_p = NULL; \
154 (_rb)->rbt_packages.rbl_u.rbl_n = (_rb)->rbt_packages.rbl_u.rbl_p = NULL; \
155 (_rb)->rbt_empty_node = NULL; \
162#define BU_RB_TREE_INIT_ZERO { BU_RB_TREE_MAGIC, 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, \
163 { 0, 0, NULL }, { 0, 0, NULL }, NULL, NULL, NULL }
168#define BU_RB_TREE_IS_INITIALIZED(_rb) (((struct bu_rb_tree *)(_rb) != BU_RB_TREE_NULL) && LIKELY((_rb)->rbt_magic == BU_RB_TREE_MAGIC))
174#define BU_RB_DEBUG_INSERT 0x00000001
175#define BU_RB_DEBUG_UNIQ 0x00000002
176#define BU_RB_DEBUG_ROTATE 0x00000004
177#define BU_RB_DEBUG_OS 0x00000008
178#define BU_RB_DEBUG_DELETE 0x00000010
197#define BU_RB_PKG_NULL ((struct bu_rb_package *) 0)
219#define BU_RB_NODE_NULL ((struct bu_rb_node *) 0)
226#define bu_rb_min(t, o) bu_rb_extreme((t), (o), SENSE_MIN)
227#define bu_rb_max(t, o) bu_rb_extreme((t), (o), SENSE_MAX)
228#define bu_rb_pred(t, o) bu_rb_neighbor((t), (o), SENSE_MIN)
229#define bu_rb_succ(t, o) bu_rb_neighbor((t), (o), SENSE_MAX)
265#define bu_rb_delete1(t) bu_rb_delete((t), 0)
326#define bu_rb_curr1(t) bu_rb_curr((t), 0)
342#define BU_RB_RETAIN_DATA ((void (*)(void *data)) 0)
343#define bu_rb_free1(t, f) \
345 BU_CKMAG((t), BU_RB_TREE_MAGIC, "red-black tree"); \
346 bu_free((char *) ((t) -> rbt_compar), \
347 "red-black compare function"); \
375#define bu_rb_is_uniq1(t) bu_rb_is_uniq((t), 0)
409#define bu_rb_uniq_on1(t) bu_rb_uniq_on((t), 0)
418#define bu_rb_uniq_off1(t) bu_rb_uniq_off((t), 0)
433#define bu_rb_rank1(t) bu_rb_rank1((t), 0)
444#define bu_rb_select1(t, k) bu_rb_select((t), 0, (k))
458#define bu_rb_search1(t, d) bu_rb_search((t), 0, (d))
505#define bu_rb_walk1(t, v, d) bu_rb_walk((t), 0, (v), (d))
507#define BU_RB_WALK_FUNC_CAST_AS_FUNC_ARG(_func) ((void (*)(void))_func)
508#define BU_RB_WALK_FUNC_CAST_AS_NODE_FUNC(_func) ((void (*)(struct bu_rb_node *, int))_func)
509#define BU_RB_WALK_FUNC_CAST_AS_DATA_FUNC(_func) ((void (*)(void *, int))_func)
510#define BU_RB_WALK_FUNC_CAST_AS_FUNC_FUNC(_func) ((void (*)(struct bu_rb_node *, int, void (*)(void), int))_func)
511#define BU_RB_WALK_FUNC_NODE_DECL(_func) void (*_func)(struct bu_rb_node *, int)
512#define BU_RB_WALK_FUNC_DATA_DECL(_func) void (*_func)(void *, int)
513#define BU_RB_WALK_FUNC_FUNC_DECL(_func) void (*_func)(struct bu_rb_node *, int, void (*)(void), int)
Header file for the BRL-CAD common definitions.
void * bu_rb_select(struct bu_rb_tree *tree, int order, int k)
void bu_rb_uniq_all_on(struct bu_rb_tree *tree)
int bu_rb_rank(struct bu_rb_tree *tree, int order)
Routines to support order-statistic operations for a red-black tree.
void bu_rb_set_uniqv(struct bu_rb_tree *tree, bitv_t vec)
struct bu_rb_tree * bu_rb_create(const char *description, int nm_orders, bu_rb_cmp_t *compare_funcs)
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.
int(* bu_rb_cmp_t)(const void *, const void *)
Routines to create a red-black tree.
void bu_rb_free(struct bu_rb_tree *tree, void(*free_data)(void *data))
Routines to free a red-black tree.
void bu_rb_delete(struct bu_rb_tree *tree, int order)
Routines to delete a node from a red-black tree.
void * bu_rb_neighbor(struct bu_rb_tree *tree, int order, int sense)
void bu_rb_uniq_all_off(struct bu_rb_tree *tree)
int bu_rb_uniq_on(struct bu_rb_tree *tree, int order)
int bu_rb_insert(struct bu_rb_tree *tree, void *data)
Routines to insert into a red-black tree.
void bu_rb_diagnose_tree(struct bu_rb_tree *tree, int order, int trav_type)
Diagnostic routines for red-black tree maintenance.
void * bu_rb_search(struct bu_rb_tree *tree, int order, void *data)
Routines to search for a node in a red-black tree.
void * bu_rb_curr(struct bu_rb_tree *tree, int order)
int bu_rb_is_uniq(struct bu_rb_tree *tree, int order)
int bu_rb_uniq_off(struct bu_rb_tree *tree, int order)
void bu_rb_walk(struct bu_rb_tree *tree, int order, void(*visit)(void), int trav_type)
Routines for traversal of red-black trees.
Global registry of recognized magic numbers.
struct bu_rb_package ** rbl_p
struct bu_rb_node ** rbl_n
union bu_rb_list::@0 rbl_u
struct bu_rb_tree * rbn_tree
struct bu_rb_package ** rbn_package
struct bu_rb_node ** rbn_right
struct bu_rb_node ** rbn_left
struct bu_rb_node ** rbn_parent
struct bu_rb_node ** rbp_node
struct bu_rb_list rbt_packages
struct bu_rb_node ** rbt_root
struct bu_rb_node * rbt_current
struct bu_rb_node * rbt_empty_node
int(** rbt_compar)(const void *, const void *)
void(* rbt_print)(void *)
const char * rbt_description
struct bu_rb_list rbt_nodes