Go to the source code of this file.
Legato Red/Black Tree API include file.
Copyright (C) Sierra Wireless Inc.
◆ le_rbtree_CompareFunc_t
typedef int(* le_rbtree_CompareFunc_t) (const void *key1Ptr, const void *key2Ptr) |
This is a comparator function to compare objects in a tree.
- Returns
- negative, 0, positive number if the first key is less, equal, or greater than the second one.
◆ le_rbtree_Color_t
Color type for Red-Black tree.
◆ le_rbtree_Find()
Find object in the tree for the given key.
- Returns
- Pointer to the Node found in the tree. NULL if not found.
- Parameters
-
[in] | treePtr | Tree to get the object from. |
[in] | keyPtr | Pointer to the key to be retrieved |
◆ le_rbtree_GetFirst()
Get the first (smallest) node in the tree.
- Returns
- Pointer to the node if successful. NULL if the tree is empty.
- Parameters
-
[in] | treePtr | Tree to get the object from. |
◆ le_rbtree_GetLast()
Get the last (greatest) node in the tree.
- Returns
- Pointer to the Node if successful. NULL if the tree is empty.
- Parameters
-
[in] | treePtr | Tree to get the object from. |
◆ le_rbtree_GetNext()
Returns the node next to currentLinkPtr without removing it from the tree. User must ensure that currentLinkPtr is in the tree.
- Returns
- Pointer to the next link if successful. NULL if there is no node greater than the currentLinkPtr.
- Parameters
-
[in] | treePtr | Tree to get the object from. |
[in] | currentLinkPtr | Current node pointer. |
◆ le_rbtree_GetPrev()
Returns the node previous to currentLinkPtr without removing it from the tree. User must ensure that currentLinkPtr is in the tree.
- Returns
- Pointer to the previous link if successful. NULL if there is no node smaller than the currentLinkPtr.
- Parameters
-
[in] | treePtr | Tree containing currentLinkPtr. |
[in] | currentLinkPtr | Get the link that is relative to this link. |
◆ le_rbtree_InitNode()
Initialize the Node Link.
- Parameters
-
[in,out] | linkPtr | Node link pointer. |
[in] | keyPtr | Key pointer. |
◆ le_rbtree_InitTree()
Initialize the Red-Black Tree.
- Parameters
-
[in] | treePtr | Pointer to the tree object. |
[in] | compFn | Pointer to the comparator function. |
◆ le_rbtree_Insert()
Insert a new node in the tree. If Node with matching key is already in the tree, does nothing (no update).
- Returns
- Pointer to the Node inserted in the tree. NULL if the node already exists in the tree (duplicate).
- Parameters
-
[in] | treePtr | Tree to insert into. |
[in] | newLinkPtr | New link to add. |
◆ le_rbtree_IsEmpty()
Tests if the Tree is empty.
- Returns
- Returns true if empty, false otherwise.
- Parameters
-
[in] | treePtr | Tree containing currentLinkPtr. |
◆ le_rbtree_Remove()
Removes the specified node from the tree.
- Returns
- Pointer to the node removed from the tree. NULL if not found.
- Parameters
-
[in] | treePtr | Tree to remove from. |
[in] | linkPtr | Link to remove. |
◆ le_rbtree_RemoveByKey()
Removes the specified node from the tree by the specified key.
- Returns
- Pointer to the node removed from the tree. NULL if not found.
- Parameters
-
[in] | treePtr | Tree to remove from. |
[in] | keyPtr | Pointer to the key to be removed |
◆ le_rbtree_Size()
Calculates size of the Tree.
- Returns
- The number of elementskeys in the Tree.
- Parameters
-
[in] | treePtr | Tree containing currentLinkPtr. |