Milena (Olena)  User documentation 2.0a Id
mln::util::tree_node< T > Class Template Reference

Class of generic tree_node for tree. More...

#include <tree.hh>

List of all members.

Public Member Functions

tree_node< T > * add_child (T elt)
 Create a tree_node with elt which become the child of the current tree_node.
tree_node< T > * add_child (tree_node< T > *tree_node)
 Bind tree_node to the current tree_node and become its child.
bool check_consistency ()
 Check the consistency of the tree_node.
children_t & children ()
 The getter of the children.
const children_t & children () const
 The getter of the children.
tree_node< T > * delete_tree_node ()
 Delete the current tree_node.
T & elt ()
 The getter of the element.
const T & elt () const
 The const getter of the element.
tree_node< T > * parent ()
 The getter of the parent.
void print (std::ostream &ostr, int level=0)
 Print on ostr the arborescence with the current tree_node as root.
tree_node< T > * search (T &elt)
 Search the tree_node with value elt in the arborescence of the current tree_node.
int search_rec (tree_node< T > **res, T &elt)
 The using method for method search.
void set_parent (tree_node< T > *parent)
 Bind tree_node to the current tree_node and become its parent.
 tree_node ()
 Constructor.
 tree_node (T elt)
 Constructor.

Detailed Description

template<typename T>
class mln::util::tree_node< T >

Class of generic tree_node for tree.

Definition at line 58 of file tree.hh.


Constructor & Destructor Documentation

template<typename T >
mln::util::tree_node< T >::tree_node ( ) [inline]

Constructor.

Definition at line 345 of file tree.hh.

template<typename T >
mln::util::tree_node< T >::tree_node ( elt) [inline]

Constructor.

Parameters:
[in]eltThe element of tree_node.

Definition at line 352 of file tree.hh.


Member Function Documentation

template<typename T >
tree_node< T > * mln::util::tree_node< T >::add_child ( elt) [inline]

Create a tree_node with elt which become the child of the current tree_node.

Parameters:
[in]eltThe element of the new child to add.
Returns:
The new tree_node created.

Definition at line 394 of file tree.hh.

template<typename T >
tree_node< T > * mln::util::tree_node< T >::add_child ( tree_node< T > *  tree_node) [inline]

Bind tree_node to the current tree_node and become its child.

Parameters:
[in]tree_nodeThe new child tree_node.
Returns:
The child tree_node.

Definition at line 407 of file tree.hh.

References mln::util::tree_node< T >::parent().

template<typename T >
bool mln::util::tree_node< T >::check_consistency ( ) [inline]

Check the consistency of the tree_node.

Returns:
true if no error, else false.

Definition at line 519 of file tree.hh.

template<typename T >
std::vector< tree_node< T > * > & mln::util::tree_node< T >::children ( ) [inline]

The getter of the children.

Returns:
The children of the tree_node.

Definition at line 378 of file tree.hh.

Referenced by mln::util::tree< T >::add_tree_up().

template<typename T >
const std::vector< tree_node< T > * > & mln::util::tree_node< T >::children ( ) const [inline]

The getter of the children.

Returns:
The children of the tree_node in const.

Definition at line 386 of file tree.hh.

template<typename T >
tree_node< T > * mln::util::tree_node< T >::delete_tree_node ( ) [inline]

Delete the current tree_node.

Definition at line 427 of file tree.hh.

template<typename T >
T & mln::util::tree_node< T >::elt ( ) [inline]

The getter of the element.

Returns:
The element of the tree_node.

Definition at line 369 of file tree.hh.

template<typename T >
const T & mln::util::tree_node< T >::elt ( ) const [inline]

The const getter of the element.

Returns:
The element of the tree_node in const.

Definition at line 361 of file tree.hh.

template<typename T >
tree_node< T > * mln::util::tree_node< T >::parent ( ) [inline]

The getter of the parent.

Returns:
The parent of the tree_node.

Definition at line 477 of file tree.hh.

Referenced by mln::util::tree_node< T >::add_child(), mln::util::branch_iter< T >::deepness(), and mln::util::branch_iter_ind< T >::deepness().

template<typename T >
void mln::util::tree_node< T >::print ( std::ostream &  ostr,
int  level = 0 
) [inline]

Print on ostr the arborescence with the current tree_node as root.

Parameters:
[in]ostrThe output stream.
[in]levelThe deep level

Definition at line 449 of file tree.hh.

template<typename T >
tree_node< T > * mln::util::tree_node< T >::search ( T &  elt) [inline]

Search the tree_node with value elt in the arborescence of the current tree_node.

Parameters:
[in]eltThe value of the searched tree_node.
Returns:
If not found 0 else the tree_node with elt value.

Definition at line 507 of file tree.hh.

template<typename T >
int mln::util::tree_node< T >::search_rec ( tree_node< T > **  res,
T &  elt 
) [inline]

The using method for method search.

Definition at line 485 of file tree.hh.

template<typename T >
void mln::util::tree_node< T >::set_parent ( tree_node< T > *  parent) [inline]

Bind tree_node to the current tree_node and become its parent.

Parameters:
[in]parentThe new parent tree_node.

Definition at line 467 of file tree.hh.

Referenced by mln::util::tree< T >::add_tree_up().

 All Classes Namespaces Functions Variables Typedefs Enumerator