48#ifndef GUM_BIN_TREE_NODE_H
49#define GUM_BIN_TREE_NODE_H
118 template <
typename Val >
353#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Node class for various binary search trees.
BinTreeNode< Val > * insertChild(const Val &val, BinTreeDir child_dir)
Adds a new child to the current node.
~BinTreeNode()
Class destructor.
BinTreeDir parentDir() const
Returns the direction of the edge parent->current node, if any.
BinTreeNode< Val > & operator=(const BinTreeNode< Val > &from)
Copy operator: copy the value of from into this.
void insertChild(BinTreeNode< Val > &new_child, BinTreeDir child_dir)
Adds a new child to the current node.
void eraseLeftLink()
Remove the link between the current node and its left child.
BinTreeNode< Val > * parent_
The parent of the node.
BinTreeNode< Val > * rightmostNode() const
Returns the rightmost node of the current tree.
BinTreeNode< Val > * leftmostNode() const
Returns the leftmost node of the current tree.
BinTreeNode< Val > * rightChild() const
Returns the given child of a node.
BinTreeNode< Val > * children_[2]
The children of the current node.
Val val_
The value stored in a node of the tree.
BinTreeDir parent_dir_
the direction to follow from the parent to reach the current node.
void eraseRightLink()
Remove the link between the current node and its right child.
BinTreeNode< Val > * insertRightChild(const Val &val)
Adds a new left child to the current node.
BinTreeNode< Val > * leftChild() const
Returns the given child of a node.
BinTreeNode(const BinTreeNode< Val > &from)
copy constructor: creates a new disconnected node with the same value as "from".
void insertRightChild(BinTreeNode< Val > &new_child)
Adds a new right child to the current node.
Val & value()
Returns the value stored in a node of the binary search tree.
void insertLeftChild(BinTreeNode< Val > &new_child)
Adds a new left child to the current node.
BinTreeNode< Val > * insertLeftChild(const Val &val)
Adds a new left child to the current node.
BinTreeNode< Val > * root() const
Returns the top ancestor of the current tree.
BinTreeNode< Val > * child(BinTreeDir dir) const
Returns the given child of a node.
BinTreeNode< Val > * parent() const
Returns the parent of a node.
void eraseLink(BinTreeDir tree_dir)
Remove the link between the current node and one of its children.
Val & operator*()
Alias for method value.
BinTreeNode(const Val &v)
Basic constructor: a node without parent nor children.
gum is the global namespace for all aGrUM entities
BinTreeDir
The direction of a given edge in a binary tree.