BRL-CAD
#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "bu/rb.h"
#include "./rb_internals.h"
Include dependency graph for rb_insert.c:

Go to the source code of this file.

Functions

HIDDEN int _rb_insert (struct bu_rb_tree *tree, int order, struct bu_rb_node *new_node)
 
int bu_rb_insert (struct bu_rb_tree *tree, void *data)
 
HIDDEN int _rb_set_uniq (struct bu_rb_tree *tree, int order, int new_value)
 
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_is_uniq (struct bu_rb_tree *tree, int order)
 
void bu_rb_set_uniqv (struct bu_rb_tree *tree, bitv_t flag_rep)
 
HIDDEN void _rb_set_uniq_all (struct bu_rb_tree *tree, int new_value)
 
void bu_rb_uniq_all_on (struct bu_rb_tree *tree)
 
void bu_rb_uniq_all_off (struct bu_rb_tree *tree)
 

Detailed Description

Routines to insert into a red-black tree

Definition in file rb_insert.c.

Function Documentation

HIDDEN int _rb_insert ( struct bu_rb_tree tree,
int  order,
struct bu_rb_node new_node 
)

Insert a node into one linear order of a red-black tree

This function has three parameters: the tree and linear order into which to insert the new node and the new node itself. If the node is equal (modulo the linear order) to a node already in the tree, _rb_insert() returns 1. Otherwise, it returns 0.

Definition at line 40 of file rb_insert.c.

References BU_CKMAG, bu_log(), BU_RB_DEBUG_INSERT, BU_RB_DEBUG_OS, BU_RB_NODE_MAGIC, BU_RB_TREE_MAGIC, RB_BLK, RB_CKORDER, RB_COMPARE_FUNC, RB_DATA, RB_GET_COLOR, RB_LEFT, RB_LEFT_CHILD, RB_NULL, RB_OTHER_CHILD, RB_OTHER_ROTATE, RB_PARENT, RB_RED, RB_RIGHT, RB_RIGHT_CHILD, RB_ROOT, RB_ROTATE, RB_SET_COLOR, RB_SIZE, bu_rb_tree::rbt_debug, and UNLIKELY.

Referenced by bu_rb_insert().

Here is the call graph for this function:

HIDDEN int _rb_set_uniq ( struct bu_rb_tree tree,
int  order,
int  new_value 
)

Raise or lower the uniqueness flag for one linear order of a red-black tree

This function has three parameters: the tree, the order for which to modify the flag, and the new value for the flag. _rb_set_uniq() sets the specified flag to the specified value and returns the previous value of the flag.

Definition at line 286 of file rb_insert.c.

References BU_CKMAG, BU_RB_TREE_MAGIC, RB_CKORDER, RB_GET_UNIQUENESS, and RB_SET_UNIQUENESS.

Referenced by bu_rb_uniq_off(), and bu_rb_uniq_on().

HIDDEN void _rb_set_uniq_all ( struct bu_rb_tree tree,
int  new_value 
)

Raise or lower the uniqueness flags for all the linear orders of a red-black tree

This function has two parameters: the tree, and the new value for all the flags.

Definition at line 353 of file rb_insert.c.

References BU_CKMAG, BU_RB_TREE_MAGIC, RB_SET_UNIQUENESS, and bu_rb_tree::rbt_nm_orders.

Referenced by bu_rb_uniq_all_off(), and bu_rb_uniq_all_on().