enum lfds711_btree_au_relative_position

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_btree_addonly_unbalanced.h

Enum

enum lfds711_btree_au_relative_position
{
  LFDS711_BTREE_AU_RELATIVE_POSITION_UP,
  LFDS711_BTREE_AU_RELATIVE_POSITION_LEFT,
  LFDS711_BTREE_AU_RELATIVE_POSITION_RIGHT,
  LFDS711_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT,
  LFDS711_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT,
  LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE,
  LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE
};

Values

LFDS711_BTREE_AU_UP

Refers to the parent element (which is NULL if performed at the root element).

LFDS711_BTREE_AU_LEFT

Refers to the left child.

LFDS711_BTREE_AU_RIGHT

Refers to the right child.

LFDS711_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT

Refers to the next smallest child element, which is to say, the rightmost child of the left child. This value does not climb the tree; it only looks for smaller children. This is NULL if there is no left child.

LFDS711_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT

Refers to the next largest child element, which is to say, the leftmost child of the right child. This value does not climb the tree; it only looks for larger children. This is NULL if there is no right child.

LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE

Refers to the next smallest element in the entire tree. As such, will climb the tree as necessary, and will not visit any elements larger than the starting element. No internal state has to be maintained to walk the tree. This is NULL when performed on the smallest element in the tree.

LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE

Refers to the next largest element in the entire tree. As such, will climb the tree as necessary, and will not visit any elements smaller than the starting element. No internal state has to be maintained to walk the tree. This is NULL when performed on the largest element in the tree.

Notes

This enum is used when navigating a tree. It typically is used to move a pointer to a btree element to point to another element, and so describes movements relative to the starting element.

In particular, for tree walking. lfds711_btree_au_get_by_absolute_position is used to get the smallest or largest element in the tree, and then LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE or LFDS711_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE (as appropriate for the direction of the walk) are repeatedly called.

A convenience function is provided which offers this functionality in a succint form, lfds711_btree_au_get_by_absolute_position_and_then_by_relative_position.

See Also