\hypertarget{a09264}{}\section{Open\+Mesh\+:\+:Utils\+:\+:HeapT$<$ Heap\+Entry, Heap\+Interface $>$ Class Template Reference}
\label{a09264}\index{Open\+Mesh\+::\+Utils\+::\+Heap\+T$<$ Heap\+Entry, Heap\+Interface $>$@{Open\+Mesh\+::\+Utils\+::\+Heap\+T$<$ Heap\+Entry, Heap\+Interface $>$}}


{\ttfamily \#include $<$O\+S\+G/\+Utils/\+Heap\+T.\+hh$>$}

Inheritance diagram for Open\+Mesh\+:\+:Utils\+:\+:HeapT$<$ Heap\+Entry, Heap\+Interface $>$\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{a09264}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09264_a24a2c62d488a9a9e73572ad7820a8e68}\label{a09264_a24a2c62d488a9a9e73572ad7820a8e68}} 
\hyperlink{a09264_a24a2c62d488a9a9e73572ad7820a8e68}{HeapT} ()
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a03ec9a9ca32d9d6409e980b90d53f54b}\label{a09264_a03ec9a9ca32d9d6409e980b90d53f54b}} 
\hyperlink{a09264_a03ec9a9ca32d9d6409e980b90d53f54b}{HeapT} (const Heap\+Interface \&\+\_\+interface)
\begin{DoxyCompactList}\small\item\em Construct with a given {\ttfamily Heap\+Iterface}. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a7e0a462d94cdd0c68aeeaaeadfa78d2d}\label{a09264_a7e0a462d94cdd0c68aeeaaeadfa78d2d}} 
\hyperlink{a09264_a7e0a462d94cdd0c68aeeaaeadfa78d2d}{$\sim$\+HeapT} ()
\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_aba777f483777c18a4ce9d7a6a87993c8}\label{a09264_aba777f483777c18a4ce9d7a6a87993c8}} 
Heap\+Interface \& {\bfseries get\+Interface} ()
\item 
\mbox{\Hypertarget{a09264_ab1c146d6ec9a3460e077d63c759437eb}\label{a09264_ab1c146d6ec9a3460e077d63c759437eb}} 
const Heap\+Interface \& {\bfseries get\+Interface} () const
\item 
\mbox{\Hypertarget{a09264_afef1992d5a553b9e8d152af61b9e4fc2}\label{a09264_afef1992d5a553b9e8d152af61b9e4fc2}} 
void \hyperlink{a09264_afef1992d5a553b9e8d152af61b9e4fc2}{clear} ()
\begin{DoxyCompactList}\small\item\em clear the heap \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a536a85f292f05b98593afbb682e54471}\label{a09264_a536a85f292f05b98593afbb682e54471}} 
bool \hyperlink{a09264_a536a85f292f05b98593afbb682e54471}{empty} () const
\begin{DoxyCompactList}\small\item\em is heap empty? \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a2c81430f8b72e3aae305b025d83c3307}\label{a09264_a2c81430f8b72e3aae305b025d83c3307}} 
size\+\_\+t \hyperlink{a09264_a2c81430f8b72e3aae305b025d83c3307}{size} () const
\begin{DoxyCompactList}\small\item\em returns the size of heap \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_ab25df952eaf2a9195243759dab1c252e}\label{a09264_ab25df952eaf2a9195243759dab1c252e}} 
void \hyperlink{a09264_ab25df952eaf2a9195243759dab1c252e}{reserve} (size\+\_\+t \+\_\+n)
\begin{DoxyCompactList}\small\item\em reserve space for \+\_\+n entries \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a35feb375cbcf48457e8e2d6307fe7fba}\label{a09264_a35feb375cbcf48457e8e2d6307fe7fba}} 
void \hyperlink{a09264_a35feb375cbcf48457e8e2d6307fe7fba}{reset\+\_\+heap\+\_\+position} (Heap\+Entry \+\_\+h)
\begin{DoxyCompactList}\small\item\em reset heap position to -\/1 (not in heap) \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_af286643ed54c1f7252989b2a525c0c07}\label{a09264_af286643ed54c1f7252989b2a525c0c07}} 
bool \hyperlink{a09264_af286643ed54c1f7252989b2a525c0c07}{is\+\_\+stored} (Heap\+Entry \+\_\+h)
\begin{DoxyCompactList}\small\item\em is an entry in the heap? \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a986a09f8eef49ee033663b59fa068c22}\label{a09264_a986a09f8eef49ee033663b59fa068c22}} 
void \hyperlink{a09264_a986a09f8eef49ee033663b59fa068c22}{insert} (Heap\+Entry \+\_\+h)
\begin{DoxyCompactList}\small\item\em insert the entry \+\_\+h \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a9a19c24235081b7e5fcdbc1ee59453c3}\label{a09264_a9a19c24235081b7e5fcdbc1ee59453c3}} 
Heap\+Entry \hyperlink{a09264_a9a19c24235081b7e5fcdbc1ee59453c3}{front} () const
\begin{DoxyCompactList}\small\item\em get the first entry \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_aa0f851857c3aee86ea1eb763a5980660}\label{a09264_aa0f851857c3aee86ea1eb763a5980660}} 
void \hyperlink{a09264_aa0f851857c3aee86ea1eb763a5980660}{pop\+\_\+front} ()
\begin{DoxyCompactList}\small\item\em delete the first entry \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_ac141346bca01e86f1f7d9e4f0f2a9d8c}\label{a09264_ac141346bca01e86f1f7d9e4f0f2a9d8c}} 
void \hyperlink{a09264_ac141346bca01e86f1f7d9e4f0f2a9d8c}{remove} (Heap\+Entry \+\_\+h)
\begin{DoxyCompactList}\small\item\em remove an entry \end{DoxyCompactList}\item 
void \hyperlink{a09264_a5a4198bf734a87481ee5fedc46f2eebd}{update} (Heap\+Entry \+\_\+h)
\item 
\mbox{\Hypertarget{a09264_a3acd94c1497f8b6afd9548ffd64e2318}\label{a09264_a3acd94c1497f8b6afd9548ffd64e2318}} 
bool \hyperlink{a09264_a3acd94c1497f8b6afd9548ffd64e2318}{check} ()
\begin{DoxyCompactList}\small\item\em check heap condition \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09264_afb629f999cdff18c71780372ffa4a655}\label{a09264_afb629f999cdff18c71780372ffa4a655}} 
Heap\+Interface \hyperlink{a09264_afb629f999cdff18c71780372ffa4a655}{interface\+\_\+}
\begin{DoxyCompactList}\small\item\em Instance of Heap\+Interface. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Types}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09264_a6a6ce0a9be43bc890a88dc17dec40429}\label{a09264_a6a6ce0a9be43bc890a88dc17dec40429}} 
typedef std\+::vector$<$ Heap\+Entry $>$ {\bfseries Base}
\item 
\mbox{\Hypertarget{a09264_a74bb768a5dde2fb600a95b1f87134882}\label{a09264_a74bb768a5dde2fb600a95b1f87134882}} 
typedef std\+::vector$<$ Heap\+Entry $>$ {\bfseries Heap\+Vector}
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09264_aa3b5a57251a46777558c9bea35013c03}\label{a09264_aa3b5a57251a46777558c9bea35013c03}} 
void \hyperlink{a09264_aa3b5a57251a46777558c9bea35013c03}{upheap} (size\+\_\+t \+\_\+idx)
\begin{DoxyCompactList}\small\item\em Upheap. Establish heap property. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a38a9bd2d0ba146e4eac3f4e9cf96bdd5}\label{a09264_a38a9bd2d0ba146e4eac3f4e9cf96bdd5}} 
void \hyperlink{a09264_a38a9bd2d0ba146e4eac3f4e9cf96bdd5}{downheap} (size\+\_\+t \+\_\+idx)
\begin{DoxyCompactList}\small\item\em Downheap. Establish heap property. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a9a39a5071efe36d6b74834bb115b4059}\label{a09264_a9a39a5071efe36d6b74834bb115b4059}} 
Heap\+Entry \hyperlink{a09264_a9a39a5071efe36d6b74834bb115b4059}{entry} (size\+\_\+t \+\_\+idx) const
\begin{DoxyCompactList}\small\item\em Get the entry at index \+\_\+idx. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a4a9b4cb124b148fbe344540bf7e8c707}\label{a09264_a4a9b4cb124b148fbe344540bf7e8c707}} 
void \hyperlink{a09264_a4a9b4cb124b148fbe344540bf7e8c707}{entry} (size\+\_\+t \+\_\+idx, Heap\+Entry \+\_\+h)
\begin{DoxyCompactList}\small\item\em Set entry \+\_\+h to index \+\_\+idx and update \+\_\+h\textquotesingle{}s heap position. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_aab929c8e37990e56e7feb552c470616f}\label{a09264_aab929c8e37990e56e7feb552c470616f}} 
size\+\_\+t \hyperlink{a09264_aab929c8e37990e56e7feb552c470616f}{parent} (size\+\_\+t \+\_\+i)
\begin{DoxyCompactList}\small\item\em Get parent\textquotesingle{}s index. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_a1884c88581582231e82713ec2dcb83b4}\label{a09264_a1884c88581582231e82713ec2dcb83b4}} 
size\+\_\+t \hyperlink{a09264_a1884c88581582231e82713ec2dcb83b4}{left} (size\+\_\+t \+\_\+i)
\begin{DoxyCompactList}\small\item\em Get left child\textquotesingle{}s index. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a09264_ac516abac46c46b480cec49702d903d7b}\label{a09264_ac516abac46c46b480cec49702d903d7b}} 
size\+\_\+t \hyperlink{a09264_ac516abac46c46b480cec49702d903d7b}{right} (size\+\_\+t \+\_\+i)
\begin{DoxyCompactList}\small\item\em Get right child\textquotesingle{}s index. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class Heap\+Entry, class Heap\+Interface = Heap\+Entry$>$\newline
class Open\+Mesh\+::\+Utils\+::\+Heap\+T$<$ Heap\+Entry, Heap\+Interface $>$}

An efficient, highly customizable heap.

The main difference (and performance boost) of this heap compared to e.\+g. the heap of the S\+TL is that here the positions of the heap\textquotesingle{}s elements are accessible from the elements themself. Therefore if one changes the priority of an element one does not have to remove and re-\/insert this element, but can just call the \hyperlink{a09264_a5a4198bf734a87481ee5fedc46f2eebd}{update(\+Heap\+Entry)} method.

This heap class is parameterized by two template arguments\+: \begin{DoxyItemize}
\item the class {\ttfamily Heap\+Entry}, that will be stored in the heap \item the Heap\+Interface telling the heap how to compare heap entries and how to store the heap positions in the heap entries.\end{DoxyItemize}
As an example how to use the class see declaration of class \hyperlink{a08932}{Decimater\+::\+DecimaterT}.

\begin{DoxySeeAlso}{See also}
\hyperlink{a09260}{Heap\+InterfaceT} 
\end{DoxySeeAlso}


Definition at line 138 of file Heap\+T.\+hh.



\subsection{Member Function Documentation}
\mbox{\Hypertarget{a09264_a5a4198bf734a87481ee5fedc46f2eebd}\label{a09264_a5a4198bf734a87481ee5fedc46f2eebd}} 
\index{Open\+Mesh\+::\+Utils\+::\+HeapT@{Open\+Mesh\+::\+Utils\+::\+HeapT}!update@{update}}
\index{update@{update}!Open\+Mesh\+::\+Utils\+::\+HeapT@{Open\+Mesh\+::\+Utils\+::\+HeapT}}
\subsubsection{\texorpdfstring{update()}{update()}}
{\footnotesize\ttfamily template$<$class Heap\+Entry , class Heap\+Interface  = Heap\+Entry$>$ \\
void \hyperlink{a09264}{Open\+Mesh\+::\+Utils\+::\+HeapT}$<$ Heap\+Entry, Heap\+Interface $>$\+::update (\begin{DoxyParamCaption}\item[{Heap\+Entry}]{\+\_\+h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

update an entry\+: change the key and update the position to reestablish the heap property. 

Definition at line 248 of file Heap\+T.\+hh.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
Open\+Flipper/libs\+\_\+required/\+Open\+Mesh/src/\+Open\+Mesh/\+Tools/\+Utils/\hyperlink{a15073}{Heap\+T.\+hh}\end{DoxyCompactItemize}
