\hypertarget{classHeap}{
\section{Heap Class Reference}
\label{classHeap}\index{Heap@{Heap}}
}
Inheritance diagram for Heap:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classHeap}
\end{center}
\end{figure}
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structHeap_1_1heap__entry}{heap\_\-entry}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classHeap_a6595efd3562a6334d2f5471c2b3b7cb4}{
\hyperlink{classHeap_a6595efd3562a6334d2f5471c2b3b7cb4}{Heap} ()}
\label{classHeap_a6595efd3562a6334d2f5471c2b3b7cb4}

\begin{DoxyCompactList}\small\item\em Default constructor used to build a standard heap with no support for removal from \hyperlink{protocolthe-p}{the} middle. \item\end{DoxyCompactList}\item 
\hyperlink{classHeap_a709da15daedd94f1adf8315aa0652a9a}{Heap} (bool)
\begin{DoxyCompactList}\small\item\em Constructor used to build a standard heap with support for removal from \hyperlink{protocolthe-p}{the} middle. \item\end{DoxyCompactList}\item 
\hypertarget{classHeap_a734051272cbd0945d3916a1a89707ba2}{
virtual \hyperlink{classHeap_a734051272cbd0945d3916a1a89707ba2}{$\sim$Heap} ()}
\label{classHeap_a734051272cbd0945d3916a1a89707ba2}

\begin{DoxyCompactList}\small\item\em Destructor. \item\end{DoxyCompactList}\item 
void \hyperlink{classHeap_af99b9460e133f72090d02bc58502534b}{push} (\hyperlink{classTimeVal}{Heap\_\-Key} k, \hyperlink{classHeapBase}{HeapBase} $\ast$p)
\begin{DoxyCompactList}\small\item\em \hyperlink{classPush}{Push} an object into \hyperlink{protocolthe-p}{the} heap by using a sorting key. \item\end{DoxyCompactList}\item 
void \hyperlink{classHeap_a0a5692e101576580485876f381b52ac7}{push} (int i)
\begin{DoxyCompactList}\small\item\em Bubble-\/up an object in \hyperlink{protocolthe-p}{the} heap. \item\end{DoxyCompactList}\item 
void \hyperlink{classHeap_ad72e3cbdea1350d3b60b6febfb04546d}{move} (\hyperlink{classTimeVal}{Heap\_\-Key} new\_\-key, \hyperlink{classHeapBase}{HeapBase} $\ast$object)
\begin{DoxyCompactList}\small\item\em Move an object in \hyperlink{protocolthe-p}{the} heap according to \hyperlink{protocolthe-p}{the} new key. \item\end{DoxyCompactList}\item 
struct \hyperlink{structHeap_1_1heap__entry}{heap\_\-entry} $\ast$ \hyperlink{classHeap_a9df9f5cf1cd12506d0e24352141586cb}{top} () const 
\begin{DoxyCompactList}\small\item\em Get a pointer to \hyperlink{protocolthe-p}{the} entry at \hyperlink{protocolthe-p}{the} top of \hyperlink{protocolthe-p}{the} heap. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classHeap_ab91af0a4a897c837edc24eb18d85a545}{size} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} number of elements in \hyperlink{protocolthe-p}{the} heap. \item\end{DoxyCompactList}\item 
\hypertarget{classHeap_abb069b736c005a7020e195a958995c42}{
void \hyperlink{classHeap_abb069b736c005a7020e195a958995c42}{pop} ()}
\label{classHeap_abb069b736c005a7020e195a958995c42}

\begin{DoxyCompactList}\small\item\em Remove \hyperlink{protocolthe-p}{the} object top of \hyperlink{protocolthe-p}{the} heap. \item\end{DoxyCompactList}\item 
void \hyperlink{classHeap_aefed6595f435c6e68b6ca4923401112e}{pop\_\-obj} (\hyperlink{classHeapBase}{HeapBase} $\ast$p)
\begin{DoxyCompactList}\small\item\em Remove an object from an arbitrary position in \hyperlink{protocolthe-p}{the} heap. \item\end{DoxyCompactList}\item 
\hypertarget{classHeap_a70baf1417c744bf963ceb90588be8ef6}{
void \hyperlink{classHeap_a70baf1417c744bf963ceb90588be8ef6}{heapify} ()}
\label{classHeap_a70baf1417c744bf963ceb90588be8ef6}

\begin{DoxyCompactList}\small\item\em Rebuild \hyperlink{protocolthe-p}{the} heap structure. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classHeap_ab902d30961f283a268f84bc704acf378}{
typedef \hyperlink{classTimeVal}{TimeVal} {\bfseries Heap\_\-Key}}
\label{classHeap_ab902d30961f283a268f84bc704acf378}

\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classHeap_aa345f7e312e40e8a76de6b6ed2222abe}{
void {\bfseries push} (\hyperlink{classTimeVal}{Heap\_\-Key} key, \hyperlink{classHeapBase}{HeapBase} $\ast$p, int son)}
\label{classHeap_aa345f7e312e40e8a76de6b6ed2222abe}

\item 
\hypertarget{classHeap_a47be5f22e36ee39569f2b357fb03fe10}{
int {\bfseries resize} (int new\_\-size)}
\label{classHeap_a47be5f22e36ee39569f2b357fb03fe10}

\item 
\hypertarget{classHeap_a093861845500c26069a87e6c4adfc2e9}{
void {\bfseries verify} ()}
\label{classHeap_a093861845500c26069a87e6c4adfc2e9}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classHeap_ae219a22a5610b816c0a2032861f9b97f}{
int {\bfseries \_\-size}}
\label{classHeap_ae219a22a5610b816c0a2032861f9b97f}

\item 
\hypertarget{classHeap_a0f8619db652b09cfed02a9ebcc45ffe8}{
int {\bfseries \_\-elements}}
\label{classHeap_a0f8619db652b09cfed02a9ebcc45ffe8}

\item 
\hypertarget{classHeap_a86e09400dbd92de57bb6cf52c50f35d6}{
bool {\bfseries \_\-intrude}}
\label{classHeap_a86e09400dbd92de57bb6cf52c50f35d6}

\item 
\hypertarget{classHeap_a79cf507e634502b8e3777d32de4ed5e8}{
struct \hyperlink{structHeap_1_1heap__entry}{heap\_\-entry} $\ast$ {\bfseries \_\-p}}
\label{classHeap_a79cf507e634502b8e3777d32de4ed5e8}

\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classHeap_a37bed02599bfb687e98de9635dc58d5d}{
class \hyperlink{classHeap_a37bed02599bfb687e98de9635dc58d5d}{TimerList}}
\label{classHeap_a37bed02599bfb687e98de9635dc58d5d}

\end{DoxyCompactItemize}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{classHeap_a709da15daedd94f1adf8315aa0652a9a}{
\index{Heap@{Heap}!Heap@{Heap}}
\index{Heap@{Heap}!Heap@{Heap}}
\subsubsection[{Heap}]{\setlength{\rightskip}{0pt plus 5cm}Heap::Heap (
\begin{DoxyParamCaption}
\item[{bool}]{intrude}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}explicit\mbox{]}}}}
\label{classHeap_a709da15daedd94f1adf8315aa0652a9a}


Constructor used to build a standard heap with support for removal from \hyperlink{protocolthe-p}{the} middle. 

Should be used with something like: 
\begin{DoxyPre}
 struct \_foo \{ ... ; int my\_index ; ... \} x;
 ...
 \hyperlink{classHeap}{Heap} *h = new \hyperlink{classHeap}{Heap} (OFFSET\_OF(x, my\_index));
 \end{DoxyPre}
 

\subsection{Member Function Documentation}
\hypertarget{classHeap_ad72e3cbdea1350d3b60b6febfb04546d}{
\index{Heap@{Heap}!move@{move}}
\index{move@{move}!Heap@{Heap}}
\subsubsection[{move}]{\setlength{\rightskip}{0pt plus 5cm}void Heap::move (
\begin{DoxyParamCaption}
\item[{{\bf Heap\_\-Key}}]{new\_\-key, }
\item[{{\bf HeapBase} $\ast$}]{object}
\end{DoxyParamCaption}
)}}
\label{classHeap_ad72e3cbdea1350d3b60b6febfb04546d}


Move an object in \hyperlink{protocolthe-p}{the} heap according to \hyperlink{protocolthe-p}{the} new key. 

Note: can only be used if \hyperlink{protocolthe-p}{the} heap supports removal from \hyperlink{protocolthe-p}{the} middle.


\begin{DoxyParams}{Parameters}
{\em new\_\-key} & \hyperlink{protocolthe-p}{the} new key. \\
\hline
{\em object} & \hyperlink{protocolthe-p}{the} object to move. \\
\hline
\end{DoxyParams}
\hypertarget{classHeap_aefed6595f435c6e68b6ca4923401112e}{
\index{Heap@{Heap}!pop\_\-obj@{pop\_\-obj}}
\index{pop\_\-obj@{pop\_\-obj}!Heap@{Heap}}
\subsubsection[{pop\_\-obj}]{\setlength{\rightskip}{0pt plus 5cm}void Heap::pop\_\-obj (
\begin{DoxyParamCaption}
\item[{{\bf HeapBase} $\ast$}]{p}
\end{DoxyParamCaption}
)}}
\label{classHeap_aefed6595f435c6e68b6ca4923401112e}


Remove an object from an arbitrary position in \hyperlink{protocolthe-p}{the} heap. 

Note: only valid if \hyperlink{protocolthe-p}{the} heap supports this kind of operation.


\begin{DoxyParams}{Parameters}
{\em p} & \hyperlink{protocolthe-p}{the} object to remove if not NULL, otherwise \hyperlink{protocolthe-p}{the} top element from \hyperlink{protocolthe-p}{the} heap. \\
\hline
\end{DoxyParams}
\hypertarget{classHeap_a0a5692e101576580485876f381b52ac7}{
\index{Heap@{Heap}!push@{push}}
\index{push@{push}!Heap@{Heap}}
\subsubsection[{push}]{\setlength{\rightskip}{0pt plus 5cm}void Heap::push (
\begin{DoxyParamCaption}
\item[{int}]{i}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classHeap_a0a5692e101576580485876f381b52ac7}


Bubble-\/up an object in \hyperlink{protocolthe-p}{the} heap. 

Note: this probably should not be exposed.


\begin{DoxyParams}{Parameters}
{\em i} & \hyperlink{protocolthe-p}{the} offset of \hyperlink{protocolthe-p}{the} object to bubble-\/up. \\
\hline
\end{DoxyParams}
\hypertarget{classHeap_af99b9460e133f72090d02bc58502534b}{
\index{Heap@{Heap}!push@{push}}
\index{push@{push}!Heap@{Heap}}
\subsubsection[{push}]{\setlength{\rightskip}{0pt plus 5cm}void Heap::push (
\begin{DoxyParamCaption}
\item[{{\bf Heap\_\-Key}}]{k, }
\item[{{\bf HeapBase} $\ast$}]{p}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classHeap_af99b9460e133f72090d02bc58502534b}


\hyperlink{classPush}{Push} an object into \hyperlink{protocolthe-p}{the} heap by using a sorting key. 


\begin{DoxyParams}{Parameters}
{\em k} & \hyperlink{protocolthe-p}{the} sorting key. \\
\hline
{\em p} & \hyperlink{protocolthe-p}{the} object to push into \hyperlink{protocolthe-p}{the} heap. \\
\hline
\end{DoxyParams}
\hypertarget{classHeap_ab91af0a4a897c837edc24eb18d85a545}{
\index{Heap@{Heap}!size@{size}}
\index{size@{size}!Heap@{Heap}}
\subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Heap::size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classHeap_ab91af0a4a897c837edc24eb18d85a545}


Get \hyperlink{protocolthe-p}{the} number of elements in \hyperlink{protocolthe-p}{the} heap. 

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} number of elements in \hyperlink{protocolthe-p}{the} heap. 
\end{DoxyReturn}
\hypertarget{classHeap_a9df9f5cf1cd12506d0e24352141586cb}{
\index{Heap@{Heap}!top@{top}}
\index{top@{top}!Heap@{Heap}}
\subsubsection[{top}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf heap\_\-entry}$\ast$ Heap::top (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, read\mbox{]}}}}
\label{classHeap_a9df9f5cf1cd12506d0e24352141586cb}


Get a pointer to \hyperlink{protocolthe-p}{the} entry at \hyperlink{protocolthe-p}{the} top of \hyperlink{protocolthe-p}{the} heap. 

Both \hyperlink{protocolthe-p}{the} key and \hyperlink{protocolthe-p}{the} value can be derived from \hyperlink{protocolthe-p}{the} return value.

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} pointer to \hyperlink{protocolthe-p}{the} entry at \hyperlink{protocolthe-p}{the} top of \hyperlink{protocolthe-p}{the} heap. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/heap.hh\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/heap.cc\end{DoxyCompactItemize}
