![]() |
RTEMS 6.3
|
The red-black tree container provides data structures and directives to manage user-defined data structures in red-black trees. More...
Macros | |
| #define | RTEMS_RBTREE_INITIALIZER_EMPTY(name) |
| RBTree initializer for an empty rbtree with designator name. | |
| #define | RTEMS_RBTREE_DEFINE_EMPTY(name) |
| RBTree definition for an empty rbtree with designator name. | |
Typedefs | |
| typedef RBTree_Node | rtems_rbtree_node |
| typedef RBTree_Control | rtems_rbtree_control |
| typedef long | rtems_rbtree_compare_result |
| Integer type for compare results. | |
| typedef rtems_rbtree_compare_result(*) | rtems_rbtree_compare(const RBTree_Node *first, const RBTree_Node *second) |
| Compares two red-black tree nodes. | |
Functions | |
| void | rtems_rbtree_initialize (rtems_rbtree_control *the_rbtree, rtems_rbtree_compare compare, void *starting_address, size_t number_nodes, size_t node_size, bool is_unique) |
| Initialize a RBTree header. | |
| rtems_rbtree_node * | rtems_rbtree_find (const rtems_rbtree_control *the_rbtree, const rtems_rbtree_node *the_node, rtems_rbtree_compare compare, bool is_unique) |
| Tries to find a node for the specified key in the tree. | |
| rtems_rbtree_node * | rtems_rbtree_insert (RBTree_Control *the_rbtree, RBTree_Node *the_node, rtems_rbtree_compare compare, bool is_unique) |
| Inserts the node into the red-black tree. | |
The red-black tree container provides data structures and directives to manage user-defined data structures in red-black trees.
The red-black tree container offers no internal protection against concurrent access. The user must ensure that at most one thread at once can access a red-black tree instance.
| #define RTEMS_RBTREE_DEFINE_EMPTY | ( | name | ) |
RBTree definition for an empty rbtree with designator name.
| #define RTEMS_RBTREE_INITIALIZER_EMPTY | ( | name | ) |
RBTree initializer for an empty rbtree with designator name.
| typedef rtems_rbtree_compare_result(*) rtems_rbtree_compare(const RBTree_Node *first, const RBTree_Node *second) |
Compares two red-black tree nodes.
| [in] | first | The first node. |
| [in] | second | The second node. |
| positive | The key value of the first node is greater than the one of the second node. |
| 0 | The key value of the first node is equal to the one of the second node. |
| negative | The key value of the first node is less than the one of the second node. |
| typedef long rtems_rbtree_compare_result |
Integer type for compare results.
The type is large enough to represent pointers and 32-bit signed integers.
| typedef RBTree_Control rtems_rbtree_control |
The rbtree's control anchors the rbtree.
| typedef RBTree_Node rtems_rbtree_node |
A node that can be manipulated in the rbtree.
| rtems_rbtree_node * rtems_rbtree_find | ( | const rtems_rbtree_control * | the_rbtree, |
| const rtems_rbtree_node * | the_node, | ||
| rtems_rbtree_compare | compare, | ||
| bool | is_unique ) |
Tries to find a node for the specified key in the tree.
| [in] | the_rbtree | The red-black tree control. |
| [in] | the_node | A node specifying the key. |
| [in] | compare | The node compare function. |
| [in] | is_unique | If true, then return the first node with a key equal to the one of the node specified if it exits, else return the last node if it exists. |
| node | A node corresponding to the key. If the tree is not unique and contains duplicate keys, the set of duplicate keys acts as FIFO. |
| NULL | No node exists in the tree for the key. |
| void rtems_rbtree_initialize | ( | rtems_rbtree_control * | the_rbtree, |
| rtems_rbtree_compare | compare, | ||
| void * | starting_address, | ||
| size_t | number_nodes, | ||
| size_t | node_size, | ||
| bool | is_unique ) |
Initialize a RBTree header.
This routine initializes the_rbtree structure to manage the contiguous array of number_nodes nodes which starts at starting_address. Each node is of node_size bytes.
| [in] | the_rbtree | is the pointer to rbtree header |
| [in] | compare | The node compare function. |
| [in] | starting_address | is the starting address of first node |
| [in] | number_nodes | is the number of nodes in rbtree |
| [in] | node_size | is the size of node in bytes |
| [in] | is_unique | If true, then reject nodes with a duplicate key, else otherwise. |
| rtems_rbtree_node * rtems_rbtree_insert | ( | RBTree_Control * | the_rbtree, |
| RBTree_Node * | the_node, | ||
| rtems_rbtree_compare | compare, | ||
| bool | is_unique ) |
Inserts the node into the red-black tree.
In case the node is already a node of a tree, then this function yields unpredictable results.
| [in] | the_rbtree | The red-black tree control. |
| [in] | the_node | The node to insert. |
| [in] | compare | The node compare function. |
| [in] | is_unique | If true, then reject nodes with a duplicate key, else insert nodes in FIFO order in case the key value is equal to existing nodes. |
| NULL | Successfully inserted. |
| existing_node | This is a unique insert and there exists a node with an equal key in the tree already. |