28 #ifndef GUM_BIN_TREE_NODE_H 29 #define GUM_BIN_TREE_NODE_H 31 #include <agrum/agrum.h> 103 template <
typename Val >
338 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 344 #include <agrum/tools/core/binTreeNode_tpl.h> void insertChild(BinTreeNode< Val > &new_child, BinTreeDir child_dir)
Adds a new child to the current node.
BinTreeDir parent_dir_
the direction to follow from the parent to reach the current node.
BinTreeNode(const BinTreeNode< Val > &from)
copy constructor: creates a new disconnected node with the same value as "from".
BinTreeNode< Val > * child(BinTreeDir dir) const
Returns the given child of a node.
Val & value()
Returns the value stored in a node of the binary search tree.
BinTreeNode< Val > * leftmostNode() const
Returns the leftmost node of the current tree.
INLINE void emplace(Args &&... args)
BinTreeNode< Val > * insertLeftChild(const Val &val)
Adds a new left child to the current node.
void eraseLeftLink()
Remove the link between the current node and its left child.
BinTreeNode< Val > * leftChild() const
Returns the given child of a node.
BinTreeNode(const Val &v)
Basic constructor: a node without parent nor children.
void eraseLink(BinTreeDir tree_dir)
Remove the link between the current node and one of its children.
BinTreeDir
The direction of a given edge in a binary tree.
BinTreeNode< Val > & operator=(const BinTreeNode< Val > &from)
Copy operator: copy the value of from into this.
BinTreeNode< Val > * rightmostNode() const
Returns the rightmost node of the current tree.
BinTreeNode< Val > * parent_
The parent of the node.
Val val_
The value stored in a node of the tree.
void eraseRightLink()
Remove the link between the current node and its right child.
BinTreeDir parentDir() const
Returns the direction of the edge parent->current node, if any.
BinTreeNode< Val > * root() const
Returns the top ancestor of the current tree.
BinTreeNode< Val > * rightChild() const
Returns the given child of a node.
BinTreeNode< Val > * parent() const
Returns the parent of a node.
BinTreeNode< Val > * children_[2]
The children of the current node.
Val & operator*()
Alias for method value.
BinTreeNode< Val > * insertRightChild(const Val &val)
Adds a new left child to the current node.
void insertLeftChild(BinTreeNode< Val > &new_child)
Adds a new left child to the current node.
~BinTreeNode()
Class destructor.
void insertRightChild(BinTreeNode< Val > &new_child)
Adds a new right child to the current node.
BinTreeNode< Val > * insertChild(const Val &val, BinTreeDir child_dir)
Adds a new child to the current node.