$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mln::util::tree_node< T > Class Template Reference

#include <mln/util/tree.hh>

Public Member Functions

 tree_node ()
 tree_node (T elt)
tree_node< T > * add_child (T elt)
tree_node< T > * add_child (tree_node< T > *tree_node)
bool check_consistency ()
children_tchildren ()
const children_tchildren () const
tree_node< T > * delete_tree_node ()
T & elt ()
const T & elt () const
tree_node< T > * parent ()
void print (std::ostream &ostr, int level=0)
tree_node< T > * search (T &elt)
int search_rec (tree_node< T > **res, T &elt)
void set_parent (tree_node< T > *parent)

Public Types

typedef std::vector< tree_node
< T > * > 
children_t

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 ( )

Constructor.

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

Constructor.

Parameters
[in]eltThe element of tree_node.

Member Function Documentation

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

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.
template<typename T>
tree_node<T>* mln::util::tree_node< T >::add_child ( tree_node< T > *  tree_node)

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.
template<typename T>
bool mln::util::tree_node< T >::check_consistency ( )

Check the consistency of the tree_node.

Returns
true if no error, else false.
template<typename T>
children_t& mln::util::tree_node< T >::children ( )

The getter of the children.

Returns
The children of the tree_node.
template<typename T>
const children_t& mln::util::tree_node< T >::children ( ) const

The getter of the children.

Returns
The children of the tree_node in const.
template<typename T>
tree_node<T>* mln::util::tree_node< T >::delete_tree_node ( )

Delete the current tree_node.

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

The getter of the element.

Returns
The element of the tree_node.
template<typename T>
const T& mln::util::tree_node< T >::elt ( ) const

The const getter of the element.

Returns
The element of the tree_node in const.
template<typename T>
tree_node<T>* mln::util::tree_node< T >::parent ( )

The getter of the parent.

Returns
The parent of the tree_node.
template<typename T>
void mln::util::tree_node< T >::print ( std::ostream &  ostr,
int  level = 0 
)

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

Parameters
[in]ostrThe output stream.
[in]levelThe deep level
template<typename T>
tree_node<T>* mln::util::tree_node< T >::search ( T &  elt)

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.
template<typename T>
int mln::util::tree_node< T >::search_rec ( tree_node< T > **  res,
T &  elt 
)

The using method for method search.

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

Bind tree_node to the current tree_node and become its parent.

Parameters
[in]parentThe new parent tree_node.

Member Typedef Documentation

template<typename T>
typedef std::vector< tree_node<T>* > mln::util::tree_node< T >::children_t

Definition at line 62 of file tree.hh.