Public Member Functions | Public Attributes

mln::util::tree_fast< T > Struct Template Reference

#include <tree_fast.hh>

List of all members.

Public Member Functions

unsigned add_child (unsigned i, T &elt)
 Add a child with value elt to the i th node.
unsigned add_parent (T &elt)
 Add a parent with value elt to this tree.
bool has (T &elt) const
 Check if the tree has elt.
bool is_root (unsigned i) const
 Check if the node at position i is the root node.
unsigned search (T &elt) const
 Search the position of the node with elt.
unsigned size () const
 Return the size of the tree.
 tree_fast ()
 Constructor.
 tree_fast (T &elt)
 Constructor.

Public Attributes

std::vector< std::vector
< unsigned > > 
child_
 The vector of the vector children position of all node of the tree.
std::vector< T > data_
 The vector of the value of all node of the tree.
std::vector< unsigned > parent_
 The vector of the parent's position of all node of the tree.
unsigned root_
 The position of the root in data_.

Detailed Description

template<typename T>
struct mln::util::tree_fast< T >

Definition at line 44 of file tree_fast.hh.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 119 of file tree_fast.hh.

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

Constructor.

Parameters:
[in] elt The value of the root of the tree.

Definition at line 125 of file tree_fast.hh.

References mln::util::tree_fast< T >::child_, mln::util::tree_fast< T >::data_, mln::util::tree_fast< T >::parent_, and mln::util::tree_fast< T >::root_.


Member Function Documentation

template<typename T >
unsigned mln::util::tree_fast< T >::add_child ( unsigned  i,
T &  elt 
) [inline]

Add a child with value elt to the i th node.

Returns:
The position of the add child.

Definition at line 180 of file tree_fast.hh.

References mln::util::tree_fast< T >::child_, mln::util::tree_fast< T >::data_, and mln::util::tree_fast< T >::parent_.

Referenced by mln::util::impl::tree_to_fast_().

template<typename T >
unsigned mln::util::tree_fast< T >::add_parent ( T &  elt  )  [inline]

Add a parent with value elt to this tree.

Returns:
The position of the new root of this tree.

Definition at line 194 of file tree_fast.hh.

References mln::util::tree_fast< T >::child_, mln::util::tree_fast< T >::data_, mln::util::tree_fast< T >::parent_, and mln::util::tree_fast< T >::root_.

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

Check if the tree has elt.

Returns:
true if it has it else false.

Definition at line 146 of file tree_fast.hh.

References mln::util::tree_fast< T >::data_.

template<typename T >
bool mln::util::tree_fast< T >::is_root ( unsigned  i  )  const [inline]

Check if the node at position i is the root node.

Returns:
true if it's the node root it else false.

Definition at line 172 of file tree_fast.hh.

References mln::util::tree_fast< T >::root_.

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

Search the position of the node with elt.

Parameters:
[in] elt The value of the searched node.
Returns:
the position of the node if it's found else UINT_MAX.

Bug the search failed.

Definition at line 158 of file tree_fast.hh.

References mln::util::tree_fast< T >::data_.

template<typename T >
unsigned mln::util::tree_fast< T >::size (  )  const [inline]

Return the size of the tree.

Returns:
the number of node of the tree.

Definition at line 137 of file tree_fast.hh.

References mln::util::tree_fast< T >::data_.


Member Data Documentation

template<typename T>
std::vector<std::vector<unsigned> > mln::util::tree_fast< T >::child_

The vector of the vector children position of all node of the tree.

Definition at line 107 of file tree_fast.hh.

Referenced by mln::util::tree_fast< T >::add_child(), mln::util::tree_fast< T >::add_parent(), mln::util::tree_fast< T >::tree_fast(), and mln::util::impl::tree_fast_to_image().

template<typename T>
std::vector<T> mln::util::tree_fast< T >::data_
template<typename T>
std::vector<unsigned> mln::util::tree_fast< T >::parent_

The vector of the parent's position of all node of the tree.

Definition at line 104 of file tree_fast.hh.

Referenced by mln::util::tree_fast< T >::add_child(), mln::util::tree_fast< T >::add_parent(), and mln::util::tree_fast< T >::tree_fast().

template<typename T>
unsigned mln::util::tree_fast< T >::root_