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

#include <mln/util/soft_heap.hh>

Public Member Functions

 soft_heap (unsigned r=20)
 ~soft_heap ()
void clear ()
head< T, R > * head_hook_ () const
bool is_empty () const
bool is_valid () const
int nelements () const
T pop_front ()
void push (const T &element)
void push (soft_heap< T, R > &sh)
void soft_clear_ ()

Public Types

typedef Object< void > category
typedef T element
typedef soft_heap< T, R > exact_t

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

Definition at line 178 of file soft_heap.hh.

Constructor & Destructor Documentation

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

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

Destructor.

Member Function Documentation

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

Clear the heap.

template<typename T, typename R>
head<T,R>* mln::util::soft_heap< T, R >::head_hook_ ( ) const

Internal use only.

Return a pointer to the first header struct of this heap.

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

Return true if there is at least one element.

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

Return true if there is at least one element.

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

Return the number of element in the heap.

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

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

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

Add a new element element.

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

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.

template<typename T, typename R>
void mln::util::soft_heap< T, R >::soft_clear_ ( )

Reset the heap to an empty heap.

Do NOT delete element which may have been inserted.

See Also
push

Member Typedef Documentation

typedef Object<void> mln::Object< soft_heap< T, R > >::category
inherited

Definition at line 106 of file object.hh.

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

Element associated type.

Definition at line 185 of file soft_heap.hh.

typedef soft_heap< T, R > mln::Object< soft_heap< T, R > >::exact_t
inherited

Definition at line 105 of file object.hh.