mln::util::soft_heap< T, R > Class Template Reference
[Utilities]

Soft heap. More...

#include <soft_heap.hh>

Inheritance diagram for mln::util::soft_heap< T, R >:

Inheritance graph

List of all members.

Public Types

typedef T element
 Element associated type.

Public Member Functions

void clear ()
 Clear the heap.
bool is_empty () const
 Return true if there is at least one element.
bool is_valid () const
 Return true if there is at least one element.
int nelements () const
 Return the number of element in the heap.
pop_front ()
 Returns the element with the lowest priority and remove it from the heap.
void push (soft_heap< T, R > &sh)
 Merge sh with this heap.
void push (const T &element)
 Add a new element element.
 soft_heap (unsigned r=20)
 Default constructor.
 ~soft_heap ()
 Destructor.


Detailed Description

template<typename T, typename R>
class mln::util::soft_heap< T, R >

Soft heap.

T key, the data to store in the heap. For instance a point 2d. R rank, for instance int_u8


Member Typedef Documentation

template<typename T, typename R>
typedef T mln::util::soft_heap< T, R >::element

Element associated type.


Constructor & Destructor Documentation

template<typename T , typename R >
mln::util::soft_heap< T, R >::soft_heap ( unsigned  r = 20  )  [inline]

Default constructor.

A corruption threshold r can be specified. This threshold means that if nodes have a rank higher than this threshold they can be "corrupted" and therefore their rank can be reduced.

template<typename T , typename R >
mln::util::soft_heap< T, R >::~soft_heap (  )  [inline]

Destructor.


Member Function Documentation

template<typename T , typename R >
void mln::util::soft_heap< T, R >::clear (  )  [inline]

Clear the heap.

template<typename T , typename R >
bool mln::util::soft_heap< T, R >::is_empty (  )  const [inline]

Return true if there is at least one element.

template<typename T , typename R >
bool mln::util::soft_heap< T, R >::is_valid (  )  const [inline]

Return true if there is at least one element.

Referenced by mln::util::soft_heap< T, R >::pop_front().

template<typename T , typename R >
int mln::util::soft_heap< T, R >::nelements (  )  const [inline]

Return the number of element in the heap.

Referenced by mln::util::soft_heap< T, R >::push().

template<typename T , typename R >
T mln::util::soft_heap< T, R >::pop_front (  )  [inline]

Returns the element with the lowest priority and remove it from the heap.

References mln::util::soft_heap< T, R >::is_valid().

template<typename T , typename R >
void mln::util::soft_heap< T, R >::push ( soft_heap< T, R > &  sh  )  [inline]

Merge sh with this heap.

Be ware that after this call, sh will be empty. This heap will hold the elements which were part of sh.

References mln::util::soft_heap< T, R >::nelements().

template<typename T , typename R >
void mln::util::soft_heap< T, R >::push ( const T &  element  )  [inline]

Add a new element element.


Generated on Tue Jul 14 16:33:18 2009 for Milena (Olena) by  doxygen 1.5.9