\hypertarget{a00411}{
\section{mln::util::soft\_\-heap$<$ T, R $>$ Class Template Reference}
\label{d2/db6/a00411}\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}}
}


Soft heap.  




{\ttfamily \#include $<$soft\_\-heap.hh$>$}



Inheritance diagram for mln::util::soft\_\-heap$<$ T, R $>$:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=280pt]{db/da3/a04015}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef T \hyperlink{a00411_aa7b718f103842d61fcdd03b744e43ba9}{element}
\begin{DoxyCompactList}\small\item\em Element associated type. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a00411_ae504d3189fc882b96527e25654162af4}{clear} ()
\begin{DoxyCompactList}\small\item\em Clear the heap. \item\end{DoxyCompactList}\item 
bool \hyperlink{a00411_af3c6ee285fa1edd5e524280e0131e375}{is\_\-empty} () const 
\begin{DoxyCompactList}\small\item\em Return true if there is at least one element. \item\end{DoxyCompactList}\item 
bool \hyperlink{a00411_a36efc454c72e41ac0345e993445d7f22}{is\_\-valid} () const 
\begin{DoxyCompactList}\small\item\em Return true if there is at least one element. \item\end{DoxyCompactList}\item 
int \hyperlink{a00411_a2f721b8e19bd08416470d2cb0d43cef2}{nelements} () const 
\begin{DoxyCompactList}\small\item\em Return the number of element in the heap. \item\end{DoxyCompactList}\item 
T \hyperlink{a00411_a8eea23618e57976197d95e6122387eba}{pop\_\-front} ()
\begin{DoxyCompactList}\small\item\em Returns the element with the lowest priority and remove it from the heap. \item\end{DoxyCompactList}\item 
void \hyperlink{a00411_a20a98e43c7919414151d487a0ca97079}{push} (\hyperlink{a00411}{soft\_\-heap}$<$ T, R $>$ \&sh)
\begin{DoxyCompactList}\small\item\em Merge {\ttfamily sh} with this heap. \item\end{DoxyCompactList}\item 
void \hyperlink{a00411_a4ae009be793a0c7559175a8690fadc6a}{push} (const T \&\hyperlink{a00411_aa7b718f103842d61fcdd03b744e43ba9}{element})
\begin{DoxyCompactList}\small\item\em Add a new element {\ttfamily element}. \item\end{DoxyCompactList}\item 
\hyperlink{a00411_a5c288cf88790f0181b35b6f364de7ea5}{soft\_\-heap} (unsigned r=20)
\begin{DoxyCompactList}\small\item\em Default constructor. \item\end{DoxyCompactList}\item 
\hyperlink{a00411_a3fbe8b617f02784a6903ddb62a5f1cde}{$\sim$soft\_\-heap} ()
\begin{DoxyCompactList}\small\item\em Destructor. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{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.



\subsection{Member Typedef Documentation}
\hypertarget{a00411_aa7b718f103842d61fcdd03b744e43ba9}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!element@{element}}
\index{element@{element}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{element}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T, typename R$>$ typedef T {\bf mln::util::soft\_\-heap}$<$ T, R $>$::{\bf element}}}
\label{d2/db6/a00411_aa7b718f103842d61fcdd03b744e43ba9}


Element associated type. 



Definition at line 185 of file soft\_\-heap.hh.



\subsection{Constructor \& Destructor Documentation}
\hypertarget{a00411_a5c288cf88790f0181b35b6f364de7ea5}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!soft\_\-heap@{soft\_\-heap}}
\index{soft\_\-heap@{soft\_\-heap}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{soft\_\-heap}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ {\bf mln::util::soft\_\-heap}$<$ T, R $>$::{\bf soft\_\-heap} (
\begin{DoxyParamCaption}
\item[{unsigned}]{ r = {\ttfamily 20}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a5c288cf88790f0181b35b6f364de7ea5}


Default constructor. 

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

Definition at line 619 of file soft\_\-heap.hh.

\hypertarget{a00411_a3fbe8b617f02784a6903ddb62a5f1cde}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!$\sim$soft\_\-heap@{$\sim$soft\_\-heap}}
\index{$\sim$soft\_\-heap@{$\sim$soft\_\-heap}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{$\sim$soft\_\-heap}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ {\bf mln::util::soft\_\-heap}$<$ T, R $>$::$\sim${\bf soft\_\-heap} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a3fbe8b617f02784a6903ddb62a5f1cde}


Destructor. 



Definition at line 631 of file soft\_\-heap.hh.



\subsection{Member Function Documentation}
\hypertarget{a00411_ae504d3189fc882b96527e25654162af4}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!clear@{clear}}
\index{clear@{clear}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{clear}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ void {\bf mln::util::soft\_\-heap}$<$ T, R $>$::clear (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_ae504d3189fc882b96527e25654162af4}


Clear the heap. 



Definition at line 771 of file soft\_\-heap.hh.

\hypertarget{a00411_af3c6ee285fa1edd5e524280e0131e375}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!is\_\-empty@{is\_\-empty}}
\index{is\_\-empty@{is\_\-empty}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{is\_\-empty}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ bool {\bf mln::util::soft\_\-heap}$<$ T, R $>$::is\_\-empty (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_af3c6ee285fa1edd5e524280e0131e375}


Return true if there is at least one element. 



Definition at line 753 of file soft\_\-heap.hh.

\hypertarget{a00411_a36efc454c72e41ac0345e993445d7f22}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!is\_\-valid@{is\_\-valid}}
\index{is\_\-valid@{is\_\-valid}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{is\_\-valid}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ bool {\bf mln::util::soft\_\-heap}$<$ T, R $>$::is\_\-valid (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a36efc454c72e41ac0345e993445d7f22}


Return true if there is at least one element. 



Definition at line 744 of file soft\_\-heap.hh.



Referenced by mln::util::soft\_\-heap$<$ T, R $>$::pop\_\-front().

\hypertarget{a00411_a2f721b8e19bd08416470d2cb0d43cef2}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!nelements@{nelements}}
\index{nelements@{nelements}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{nelements}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ int {\bf mln::util::soft\_\-heap}$<$ T, R $>$::nelements (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a2f721b8e19bd08416470d2cb0d43cef2}


Return the number of element in the heap. 



Definition at line 762 of file soft\_\-heap.hh.



Referenced by mln::util::soft\_\-heap$<$ T, R $>$::push().

\hypertarget{a00411_a8eea23618e57976197d95e6122387eba}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!pop\_\-front@{pop\_\-front}}
\index{pop\_\-front@{pop\_\-front}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{pop\_\-front}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ T {\bf mln::util::soft\_\-heap}$<$ T, R $>$::pop\_\-front (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a8eea23618e57976197d95e6122387eba}


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



Definition at line 675 of file soft\_\-heap.hh.



References mln::util::soft\_\-heap$<$ T, R $>$::is\_\-valid().

\hypertarget{a00411_a4ae009be793a0c7559175a8690fadc6a}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!push@{push}}
\index{push@{push}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{push}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ void {\bf mln::util::soft\_\-heap}$<$ T, R $>$::push (
\begin{DoxyParamCaption}
\item[{const T \&}]{ element}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a4ae009be793a0c7559175a8690fadc6a}


Add a new element {\ttfamily element}. 



Definition at line 646 of file soft\_\-heap.hh.

\hypertarget{a00411_a20a98e43c7919414151d487a0ca97079}{
\index{mln::util::soft\_\-heap@{mln::util::soft\_\-heap}!push@{push}}
\index{push@{push}!mln::util::soft_heap@{mln::util::soft\_\-heap}}
\subsubsection[{push}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename R $>$ void {\bf mln::util::soft\_\-heap}$<$ T, R $>$::push (
\begin{DoxyParamCaption}
\item[{{\bf soft\_\-heap}$<$ T, R $>$ \&}]{ sh}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db6/a00411_a20a98e43c7919414151d487a0ca97079}


Merge {\ttfamily sh} with this heap. 

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

Definition at line 658 of file soft\_\-heap.hh.



References mln::util::soft\_\-heap$<$ T, R $>$::nelements().

