18#define A_RBT_ROOT {A_NULL}
32#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
48#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
63#if defined(A_SIZE_POINTER) && (A_SIZE_POINTER + 0 > 1)
66 node->parent = parent;
88#if defined(__cplusplus)
209#if defined(__cplusplus)
219#define a_rbt_entry(ptr, type, member) a_container_of(ptr, type, member)
237#define a_rbt_foreach(cur, root) \
238 for (a_rbt_node *cur = a_rbt_head(root); cur; cur = a_rbt_next(cur))
239#define A_RBT_FOREACH(cur, root) \
240 for (cur = a_rbt_head(root); cur; cur = a_rbt_next(cur))
258#define a_rbt_foreach_reverse(cur, root) \
259 for (a_rbt_node *cur = a_rbt_tail(root); cur; cur = a_rbt_prev(cur))
260#define A_RBT_FOREACH_REVERSE(cur, root) \
261 for (cur = a_rbt_tail(root); cur; cur = a_rbt_prev(cur))
279#define a_rbt_pre_foreach(cur, root) \
280 for (a_rbt_node *cur = (root)->node; cur; cur = a_rbt_pre_next(cur))
281#define A_RBT_PRE_FOREACH(cur, root) \
282 for (cur = (root)->node; cur; cur = a_rbt_pre_next(cur))
300#define a_rbt_pre_foreach_reverse(cur, root) \
301 for (a_rbt_node *cur = (root)->node; cur; cur = a_rbt_pre_prev(cur))
302#define A_RBT_PRE_FOREACH_REVERSE(cur, root) \
303 for (cur = (root)->node; cur; cur = a_rbt_pre_prev(cur))
321#define a_rbt_post_foreach(cur, root) \
322 for (a_rbt_node *cur = a_rbt_post_head(root); cur; cur = a_rbt_post_next(cur))
323#define A_RBT_POST_FOREACH(cur, root) \
324 for (cur = a_rbt_post_head(root); cur; cur = a_rbt_post_next(cur))
342#define a_rbt_post_foreach_reverse(cur, root) \
343 for (a_rbt_node *cur = a_rbt_post_tail(root); cur; cur = a_rbt_post_prev(cur))
344#define A_RBT_POST_FOREACH_REVERSE(cur, root) \
345 for (cur = a_rbt_post_tail(root); cur; cur = a_rbt_post_prev(cur))
364#define a_rbt_fortear(cur, next, root) \
365 for (a_rbt_node *next = A_NULL, *cur = a_rbt_tear(root, &next); cur; cur = a_rbt_tear(root, &next))
366#define A_RBT_FORTEAR(cur, next, root) \
367 for ((void)(next = A_NULL), cur = a_rbt_tear(root, &next); cur; cur = a_rbt_tear(root, &next))
a_rbt_node * a_rbt_pre_next(a_rbt_node *node)
access next node of red–black binary search tree node preorder
a_rbt_node * a_rbt_head(a_rbt const *root)
access head node of red–black binary search tree in-order
a_rbt_node * a_rbt_next(a_rbt_node *node)
access next node of red–black binary search tree node in-order
void a_rbt_remove(a_rbt *root, a_rbt_node *node)
remove specified node from red–black binary search tree
a_rbt_node * a_rbt_post_prev(a_rbt_node *node)
access prev node of red–black binary search tree node postorder
a_rbt_node * a_rbt_post_head(a_rbt const *root)
access head node of red–black binary search tree postorder
a_rbt_node * a_rbt_parent(a_rbt_node const *node)
access parent of red–black binary search tree node
Definition rbt.h:46
a_rbt_node * a_rbt_prev(a_rbt_node *node)
access prev node of red–black binary search tree node in-order
void a_rbt_insert_adjust(a_rbt *root, a_rbt_node *node)
rebalance the tree after insertion of the specified node
a_rbt_node * a_rbt_insert(a_rbt *root, a_rbt_node *node, int(*cmp)(void const *, void const *))
insert specified node into red–black binary search tree
a_rbt_node * a_rbt_pre_prev(a_rbt_node *node)
access prev node of red–black binary search tree node preorder
a_rbt_node * a_rbt_init(a_rbt_node *node, a_rbt_node *parent)
initialize for red–black binary search tree node
Definition rbt.h:61
a_rbt_node * a_rbt_tear(a_rbt *root, a_rbt_node **next)
tear a node from red–black binary search tree
a_rbt_node * a_rbt_post_next(a_rbt_node *node)
access next node of red–black binary search tree node postorder
a_rbt_node * a_rbt_post_tail(a_rbt const *root)
access tail node of red–black binary search tree postorder
void a_rbt_root(a_rbt *root)
initialize for red–black binary search tree root
Definition rbt.h:86
a_rbt_node * a_rbt_tail(a_rbt const *root)
access tail node of red–black binary search tree in-order
a_rbt_node * a_rbt_search(a_rbt const *root, void const *ctx, int(*cmp)(void const *, void const *))
search specified content from red–black binary search tree
#define a_uptr_c(x)
static cast to a_uptr
Definition a.h:735
unsigned long a_uptr
unsigned integer type capable of holding a pointer to void
Definition a.h:738
instance structure for red–black binary search tree node
Definition rbt.h:25
struct a_rbt_node * right
Definition rbt.h:27
struct a_rbt_node * left
Definition rbt.h:26
a_uptr parent_
Definition rbt.h:33
instance structure for red–black binary search tree root
Definition rbt.h:78
struct a_rbt_node * node
Definition rbt.h:79