BRL-CAD
redblack.h
Go to the documentation of this file.
1 /* R E D B L A C K . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #ifndef BU_REDBLACK_H
22 #define BU_REDBLACK_H
23 
24 #include "common.h"
25 
26 #include "bu/defines.h"
27 #include "bu/magic.h"
28 #include "bu/bitv.h"
29 
30 __BEGIN_DECLS
31 
32 /*----------------------------------------------------------------------*/
33 /** @addtogroup bu_rb
34  *
35  * @brief
36  * The data structures and constants for red-black trees.
37  *
38  * Many of these routines are based on the algorithms in chapter 13 of
39  * Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest,
40  * "Introduction to Algorithms", MIT Press, Cambridge, MA, 1990.
41  *
42  * FIXME: check implementation given the following note:
43  *
44  * Note that the third edition was published in 2009 and the book
45  * has had significant updates since the first edition. Quoting the
46  * authors in the preface: "The way we delete a node from binary search
47  * trees (which includes red-black trees) now guarantees that the node
48  * requested for deletion is the node that is actually deleted. In the
49  * first two editions, in certain cases, some other node would be
50  * deleted, with its contents moving into the node passed to the
51  * deletion procedure. With our new way to delete nodes, if other
52  * components of a program maintain pointers to nodes in the tree, they
53  * will not mistakenly end up with stale pointers to nodes that have
54  * been deleted."
55  *
56  * This implementation of balanced binary red-black tree operations
57  * provides all the basic dynamic set operations (e.g., insertion,
58  * deletion, search, minimum, maximum, predecessor, and successor) and
59  * order-statistic operations (i.e., select and rank) with optimal
60  * O(log(n)) performance while sorting on multiple keys. Such an
61  * implementation is referred to as an "augmented red-black tree" and
62  * is discussed in Chapter 14 of the 2009 edition of "Introduction to
63  * Algorithms."
64  */
65 /** @{ */
66 /** @file bu/redblack.h */
67 
68 
69 /**
70  * List of nodes or packages.
71  *
72  * The red-black tree package uses this structure to maintain lists of
73  * all the nodes and all the packages in the tree. Applications
74  * should not muck with these things. They are maintained only to
75  * facilitate freeing bu_rb_trees.
76  *
77  * This is a PRIVATE structure.
78  */
79 struct bu_rb_list
80 {
81  size_t size, capacity;
82  union
83  {
84  struct bu_rb_node **rbl_n;
85  struct bu_rb_package **rbl_p;
86  } rbl_u;
87 };
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; \
93  (_l)._m = NULL; \
94  }
95 
96 #define BU_RB_LIST_INIT_CAPACITY 4
97 
98 
99 /**
100  * This is the only data structure used in the red-black tree package
101  * to which application software need make any explicit reference.
102  *
103  * The members of this structure are grouped into three classes:
104  *
105  * Class I: Reading is appropriate, when necessary,
106  * but applications should not modify.
107  * Class II: Reading and modifying are both appropriate,
108  * when necessary.
109  * Class III: All access should be through routines
110  * provided in the package. Touch these
111  * at your own risk!
112  */
113 struct bu_rb_tree {
114  /***** CLASS I - Applications may read directly. ****************/
115  uint32_t rbt_magic; /**< Magic no. for integrity check */
116  int rbt_nm_nodes; /**< Number of nodes */
117 
118  /**** CLASS II - Applications may read/write directly. **********/
119  void (*rbt_print)(void *); /**< Data pretty-print function */
120  int rbt_debug; /**< Debug bits */
121  const char *rbt_description; /**< Comment for diagnostics */
122 
123  /*** CLASS III - Applications should NOT manipulate directly. ***/
124  int rbt_nm_orders; /**< Number of simultaneous orders */
125  int (**rbt_compar)(const void *, const void *); /**< Comparison functions */
126  struct bu_rb_node **rbt_root; /**< The actual trees */
127  char *rbt_unique; /**< Uniqueness flags */
128  struct bu_rb_node *rbt_current; /**< Current node */
129  struct bu_rb_list rbt_nodes; /**< All nodes */
130  struct bu_rb_list rbt_packages; /**< All packages */
131  struct bu_rb_node *rbt_empty_node; /**< Sentinel representing nil */
132 };
133 typedef struct bu_rb_tree bu_rb_tree_t;
134 #define BU_RB_TREE_NULL ((struct bu_rb_tree *) 0)
135 
136 /**
137  * asserts the integrity of a bu_rb_tree struct.
138  */
139 #define BU_CK_RB_TREE(_rb) BU_CKMAG(_rb, BU_RB_TREE_MAGIC, "bu_rb_tree")
140 
141 /**
142  * initializes a bu_rb_tree struct without allocating any memory.
143  */
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; \
156  }
157 
158 /**
159  * macro suitable for declaration statement initialization of a
160  * bu_rb_tree struct. does not allocate memory.
161  */
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 }
164 
165 /**
166  * returns truthfully whether a bu_rb_tree has been initialized.
167  */
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))
169 
170 
171 /*
172  * Debug bit flags for member rbt_debug
173  */
174 #define BU_RB_DEBUG_INSERT 0x00000001 /**< Insertion process */
175 #define BU_RB_DEBUG_UNIQ 0x00000002 /**< Uniqueness of inserts */
176 #define BU_RB_DEBUG_ROTATE 0x00000004 /**< Rotation process */
177 #define BU_RB_DEBUG_OS 0x00000008 /**< Order-statistic operations */
178 #define BU_RB_DEBUG_DELETE 0x00000010 /**< Deletion process */
179 
180 /**
181  * Wrapper for application data.
182  *
183  * This structure provides a level of indirection between the
184  * application software's data and the red-black nodes in which the
185  * data is stored. It is necessary because of the algorithm for
186  * deletion, which generally shuffles data among nodes in the tree.
187  * The package structure allows the application data to remember which
188  * node "contains" it for each order.
189  */
190 struct bu_rb_package
191 {
192  uint32_t rbp_magic; /**< Magic no. for integrity check */
193  struct bu_rb_node **rbp_node; /**< Containing nodes */
194  size_t rbp_list_pos; /**< Place in the list of all pkgs. */
195  void *rbp_data; /**< Application data */
196 };
197 #define BU_RB_PKG_NULL ((struct bu_rb_package *) 0)
198 
199 /**
200  * For the most part, there is a one-to-one correspondence between
201  * nodes and chunks of application data. When a node is created, all
202  * of its package pointers (one per order of the tree) point to the
203  * same chunk of data. However, subsequent deletions usually muddy
204  * this tidy state of affairs.
205  */
206 struct bu_rb_node
207 {
208  uint32_t rbn_magic; /**< Magic no. for integrity check */
209  struct bu_rb_tree *rbn_tree; /**< Tree containing this node */
210  struct bu_rb_node **rbn_parent; /**< Parents */
211  struct bu_rb_node **rbn_left; /**< Left subtrees */
212  struct bu_rb_node **rbn_right; /**< Right subtrees */
213  char *rbn_color; /**< Colors of this node */
214  int *rbn_size; /**< Sizes of subtrees rooted here */
215  struct bu_rb_package **rbn_package; /**< Contents of this node */
216  int rbn_pkg_refs; /**< How many orders are being used? */
217  size_t rbn_list_pos; /**< Place in the list of all nodes */
218 };
219 #define BU_RB_NODE_NULL ((struct bu_rb_node *) 0)
220 
221 /*
222  * Applications interface to bu_rb_extreme()
223  */
224 #define SENSE_MIN 0
225 #define SENSE_MAX 1
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)
230 
231 /*
232  * Applications interface to bu_rb_walk()
233  */
234 enum BU_RB_WALK_ORDER {
238 };
239 
240 /** @brief Routines to create a red-black tree */
241 
242 /**
243  * Create a red-black tree
244  *
245  * This function has three parameters: a comment describing the tree
246  * to create, the number of linear orders to maintain simultaneously,
247  * and the comparison functions (one per order). bu_rb_create()
248  * returns a pointer to the red-black tree header record.
249  */
250 typedef int (*bu_rb_cmp_t)(const void *, const void *);
251 BU_EXPORT extern struct bu_rb_tree *bu_rb_create(const char *description, int nm_orders, bu_rb_cmp_t *compare_funcs);
252 
253 /** @brief Routines to delete a node from a red-black tree */
254 
255 /**
256  * Applications interface to _rb_delete()
257  *
258  * This function has two parameters: the tree and order from which to
259  * do the deleting. bu_rb_delete() removes the data block stored in
260  * the current node (in the position of the specified order) from
261  * every order in the tree.
262  */
263 BU_EXPORT extern void bu_rb_delete(struct bu_rb_tree *tree,
264  int order);
265 #define bu_rb_delete1(t) bu_rb_delete((t), 0)
266 
267 /** @brief Diagnostic routines for red-black tree maintenance */
268 
269 /**
270  * Produce a diagnostic printout of a red-black tree
271  *
272  * This function has three parameters: the root and order of the tree
273  * to print out and the type of traversal (preorder, inorder, or
274  * postorder).
275  */
276 BU_EXPORT extern void bu_rb_diagnose_tree(struct bu_rb_tree *tree,
277  int order,
278  int trav_type);
279 
280 /**
281  * Describe a red-black tree
282  *
283  * This function has one parameter: a pointer to a red-black tree.
284  * bu_rb_summarize_tree() prints out the header information for the
285  * tree. It is intended for diagnostic purposes.
286  */
287 BU_EXPORT extern void bu_rb_summarize_tree(struct bu_rb_tree *tree);
288 
289 /** @brief Routines to extract mins, maxes, adjacent, and current nodes from a red-black tree */
290 
291 /**
292  * Applications interface to rb_extreme()
293  *
294  * This function has three parameters: the tree in which to find an
295  * extreme node, the order on which to do the search, and the sense
296  * (min or max). On success, bu_rb_extreme() returns a pointer to the
297  * data in the extreme node. Otherwise it returns NULL.
298  */
299 BU_EXPORT extern void *bu_rb_extreme(struct bu_rb_tree *tree,
300  int order,
301  int sense);
302 
303 /**
304  * Return a node adjacent to the current red-black node
305  *
306  * This function has three parameters: the tree and order on which to
307  * do the search and the sense (min or max, which is to say
308  * predecessor or successor) of the search. bu_rb_neighbor() returns
309  * a pointer to the data in the node adjacent to the current node in
310  * the specified direction, if that node exists. Otherwise, it
311  * returns NULL.
312  */
313 BU_EXPORT extern void *bu_rb_neighbor(struct bu_rb_tree *tree,
314  int order,
315  int sense);
316 
317 /**
318  * Return the current red-black node
319  *
320  * This function has two parameters: the tree and order in which to
321  * find the current node. bu_rb_curr() returns a pointer to the data
322  * in the current node, if it exists. Otherwise, it returns NULL.
323  */
324 BU_EXPORT extern void *bu_rb_curr(struct bu_rb_tree *tree,
325  int order);
326 #define bu_rb_curr1(t) bu_rb_curr((t), 0)
327 
328 /** @brief Routines to free a red-black tree */
329 
330 /**
331  * Free a red-black tree
332  *
333  * This function has two parameters: the tree to free and a function
334  * to handle the application data. bu_rb_free() traverses tree's
335  * lists of nodes and packages, freeing each one in turn, and then
336  * frees tree itself. If free_data is non-NULL, then bu_rb_free()
337  * calls it just* before freeing each package, passing it the
338  * package's rbp_data member. Otherwise, the application data is left
339  * untouched.
340  */
341 BU_EXPORT extern void bu_rb_free(struct bu_rb_tree *tree, void (*free_data)(void *data));
342 #define BU_RB_RETAIN_DATA ((void (*)(void *data)) 0)
343 #define bu_rb_free1(t, f) \
344  { \
345  BU_CKMAG((t), BU_RB_TREE_MAGIC, "red-black tree"); \
346  bu_free((char *) ((t) -> rbt_compar), \
347  "red-black compare function"); \
348  bu_rb_free(t, f); \
349  }
350 
351 /** @brief Routines to insert into a red-black tree */
352 
353 /**
354  * Applications interface to bu_rb_insert()
355  *
356  * This function has two parameters: the tree into which to insert the
357  * new node and the contents of the node. If a uniqueness requirement
358  * would be violated, bu_rb_insert() does nothing but return a number
359  * from the set {-1, -2, ..., -nm_orders} of which the absolute value
360  * is the first order for which a violation exists. Otherwise, it
361  * returns the number of orders for which the new node was equal to a
362  * node already in the tree.
363  */
364 BU_EXPORT extern int bu_rb_insert(struct bu_rb_tree *tree,
365  void *data);
366 
367 /**
368  * Query the uniqueness flag for one order of a red-black tree
369  *
370  * This function has two parameters: the tree and the order for which
371  * to query uniqueness.
372  */
373 BU_EXPORT extern int bu_rb_is_uniq(struct bu_rb_tree *tree,
374  int order);
375 #define bu_rb_is_uniq1(t) bu_rb_is_uniq((t), 0)
376 
377 /**
378  * Set the uniqueness flags for all the linear orders of a red-black
379  * tree
380  *
381  * This function has two parameters: the tree and a bitv_t encoding
382  * the flag values. bu_rb_set_uniqv() sets the flags according to the
383  * bits in flag_rep. For example, if flag_rep = 1011_2, then the
384  * first, second, and fourth orders are specified unique, and the
385  * third is specified not-necessarily unique.
386  */
387 BU_EXPORT extern void bu_rb_set_uniqv(struct bu_rb_tree *tree,
388  bitv_t vec);
389 
390 /**
391  * These functions have one parameter: the tree for which to
392  * require uniqueness/permit nonuniqueness.
393  */
394 BU_EXPORT extern void bu_rb_uniq_all_off(struct bu_rb_tree *tree);
395 
396 /**
397  * These functions have one parameter: the tree for which to
398  * require uniqueness/permit nonuniqueness.
399  */
400 BU_EXPORT extern void bu_rb_uniq_all_on(struct bu_rb_tree *tree);
401 
402 /**
403  * Has two parameters: the tree and the order for which to require
404  * uniqueness/permit nonuniqueness. Each sets the specified flag to
405  * the specified value and returns the previous value of the flag.
406  */
407 BU_EXPORT extern int bu_rb_uniq_on(struct bu_rb_tree *tree,
408  int order);
409 #define bu_rb_uniq_on1(t) bu_rb_uniq_on((t), 0)
410 
411 /**
412  * Has two parameters: the tree and the order for which to require
413  * uniqueness/permit nonuniqueness. Each sets the specified flag to
414  * the specified value and returns the previous value of the flag.
415  */
416 BU_EXPORT extern int bu_rb_uniq_off(struct bu_rb_tree *tree,
417  int order);
418 #define bu_rb_uniq_off1(t) bu_rb_uniq_off((t), 0)
419 
420 /** @brief Routines to support order-statistic operations for a red-black tree */
421 
422 /**
423  * Determines the rank of a node in one order of a red-black tree.
424  *
425  * This function has two parameters: the tree in which to search and
426  * the order on which to do the searching. If the current node is
427  * null, bu_rb_rank() returns 0. Otherwise, it returns the rank of
428  * the current node in the specified order. bu_rb_rank() is an
429  * implementation of the routine OS-RANK on p. 283 of Cormen et al.
430  */
431 BU_EXPORT extern int bu_rb_rank(struct bu_rb_tree *tree,
432  int order);
433 #define bu_rb_rank1(t) bu_rb_rank1((t), 0)
434 
435 /**
436  * This function has three parameters: the tree in which to search,
437  * the order on which to do the searching, and the rank of interest.
438  * On success, bu_rb_select() returns a pointer to the data block in
439  * the discovered node. Otherwise, it returns NULL.
440  */
441 BU_EXPORT extern void *bu_rb_select(struct bu_rb_tree *tree,
442  int order,
443  int k);
444 #define bu_rb_select1(t, k) bu_rb_select((t), 0, (k))
445 
446 /** @brief Routines to search for a node in a red-black tree */
447 
448 /**
449  * This function has three parameters: the tree in which to search,
450  * the order on which to do the searching, and a data block containing
451  * the desired value of the key. On success, bu_rb_search() returns a
452  * pointer to the data block in the discovered node. Otherwise, it
453  * returns NULL.
454  */
455 BU_EXPORT extern void *bu_rb_search(struct bu_rb_tree *tree,
456  int order,
457  void *data);
458 #define bu_rb_search1(t, d) bu_rb_search((t), 0, (d))
459 
460 /** @brief Routines for traversal of red-black trees */
461 
462 /**
463  * The function bu_rb_walk() is defined in terms of the function
464  * rb_walk(), which, in turn, calls any of the six functions
465  *
466  * @arg - static void prewalknodes()
467  * @arg - static void inwalknodes()
468  * @arg - static void postwalknodes()
469  * @arg - static void prewalkdata()
470  * @arg - static void inwalkdata()
471  * @arg - static void postwalkdata()
472  *
473  * depending on the type of traversal desired and the objects
474  * to be visited (nodes themselves, or merely the data stored
475  * in them). Each of these last six functions has four parameters:
476  * the root of the tree to traverse, the order on which to do the
477  * walking, the function to apply at each visit, and the current
478  * depth in the tree.
479  *
480  * This function has four parameters: the tree to traverse, the order
481  * on which to do the walking, the function to apply to each node, and
482  * the type of traversal (preorder, inorder, or postorder).
483  *
484  * Note the function to apply has the following signature ONLY when it
485  * is used as an argument:
486  *
487  * void (*visit)(void)
488  *
489  * When used as a function the pointer should be cast back to one of its real
490  * signatures depending on what it is operating on (node or data):
491  *
492  * node:
493  *
494  * void (*visit)((struct bu_rb_node *, int)
495  *
496  * data:
497  *
498  * void (*visit)((void *, int)
499  *
500  * Use the macros below to ensure accurate casting. See
501  * libbu/rb_diag.c and libbu/rb_walk.c for examples of their use.
502  *
503  */
504 BU_EXPORT extern void bu_rb_walk(struct bu_rb_tree *tree, int order, void (*visit)(void), int trav_type);
505 #define bu_rb_walk1(t, v, d) bu_rb_walk((t), 0, (v), (d))
506 
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)
514 
515 /** @} */
516 
517 __END_DECLS
518 
519 #endif /* BU_REDBLACK_H */
520 
521 /*
522  * Local Variables:
523  * mode: C
524  * tab-width: 8
525  * indent-tabs-mode: t
526  * c-file-style: "stroustrup"
527  * End:
528  * ex: shiftwidth=4 tabstop=8
529  */
Header file for the BRL-CAD common definitions.
unsigned char bitv_t
Definition: bitv.h:62
struct bu_rb_tree * bu_rb_create(const char *description, int nm_orders, bu_rb_cmp_t *compare_funcs)
void * bu_rb_select(struct bu_rb_tree *tree, int order, int k)
BU_RB_WALK_ORDER
Definition: redblack.h:235
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_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)
void * bu_rb_curr(struct bu_rb_tree *tree, int order)
void bu_rb_summarize_tree(struct bu_rb_tree *tree)
int(* bu_rb_cmp_t)(const void *, const void *)
Routines to create a red-black tree.
Definition: redblack.h:251
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_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_extreme(struct bu_rb_tree *tree, int order, int sense)
Routines to extract mins, maxes, adjacent, and current nodes from 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_neighbor(struct bu_rb_tree *tree, int order, int sense)
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.
@ BU_RB_WALK_POSTORDER
Definition: redblack.h:238
@ BU_RB_WALK_PREORDER
Definition: redblack.h:236
@ BU_RB_WALK_INORDER
Definition: redblack.h:237
Global registry of recognized magic numbers.
struct bu_rb_package ** rbl_p
Definition: redblack.h:86
struct bu_rb_node ** rbl_n
Definition: redblack.h:85
size_t size
Definition: redblack.h:82
union bu_rb_list::@0 rbl_u
size_t capacity
Definition: redblack.h:82
char * rbn_color
Definition: redblack.h:214
struct bu_rb_tree * rbn_tree
Definition: redblack.h:210
uint32_t rbn_magic
Definition: redblack.h:209
struct bu_rb_package ** rbn_package
Definition: redblack.h:216
struct bu_rb_node ** rbn_right
Definition: redblack.h:213
struct bu_rb_node ** rbn_left
Definition: redblack.h:212
size_t rbn_list_pos
Definition: redblack.h:218
int * rbn_size
Definition: redblack.h:215
int rbn_pkg_refs
Definition: redblack.h:217
struct bu_rb_node ** rbn_parent
Definition: redblack.h:211
uint32_t rbp_magic
Definition: redblack.h:193
void * rbp_data
Definition: redblack.h:196
struct bu_rb_node ** rbp_node
Definition: redblack.h:194
size_t rbp_list_pos
Definition: redblack.h:195
int rbt_nm_nodes
Definition: redblack.h:117
struct bu_rb_list rbt_packages
Definition: redblack.h:131
int rbt_debug
Definition: redblack.h:121
struct bu_rb_node ** rbt_root
Definition: redblack.h:127
struct bu_rb_node * rbt_current
Definition: redblack.h:129
int rbt_nm_orders
Definition: redblack.h:125
char * rbt_unique
Definition: redblack.h:128
uint32_t rbt_magic
Definition: redblack.h:116
struct bu_rb_node * rbt_empty_node
Definition: redblack.h:132
int(** rbt_compar)(const void *, const void *)
Definition: redblack.h:126
void(* rbt_print)(void *)
Definition: redblack.h:120
const char * rbt_description
Definition: redblack.h:122
struct bu_rb_list rbt_nodes
Definition: redblack.h:130
Definition: tree.h:148