\hypertarget{HEAP_8h}{
\section{HEAP.h File Reference}
\label{HEAP_8h}\index{HEAP.h@{HEAP.h}}
}
HEAP, interface file. 



This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=94pt]{HEAP_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__HEAP}{\_\-HEAP}
\begin{CompactList}\small\item\em Context structure for a heap. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef int($\ast$ \hyperlink{HEAP_8h_a0}{HEAP\_\-compare} )(const void $\ast$key1, const void $\ast$key2)
\begin{CompactList}\small\item\em Comparison function used to sort the heap. \item\end{CompactList}\item 
typedef void($\ast$ \hyperlink{HEAP_8h_a1}{HEAP\_\-destroy} )(void $\ast$data)
\begin{CompactList}\small\item\em Call back function to destroy (freed) the data. \item\end{CompactList}\item 
typedef \hyperlink{struct__HEAP}{\_\-HEAP} \hyperlink{HEAP_8h_a2}{HEAP}
\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__HEAP}{\_\-HEAP}\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{HEAP_8h_a3}{HEAP\_\-init} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap, \hyperlink{HEAP_8h_a0}{HEAP\_\-compare} compare, \hyperlink{HEAP_8h_a1}{HEAP\_\-destroy} destroy)
\begin{CompactList}\small\item\em Initializes a heap for use. \item\end{CompactList}\item 
void \hyperlink{HEAP_8h_a4}{HEAP\_\-free} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap)
\begin{CompactList}\small\item\em Frees all the nodes of the heap. \item\end{CompactList}\item 
int \hyperlink{HEAP_8h_a5}{HEAP\_\-insert} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap, const void $\ast$data)
\begin{CompactList}\small\item\em Inserts a node with the specified data on the heap. \item\end{CompactList}\item 
int \hyperlink{HEAP_8h_a6}{HEAP\_\-extract} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap, void $\ast$$\ast$data)
\begin{CompactList}\small\item\em Extracts (removes) the top node of the heap. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{HEAP_8h_a7}{HEAP\_\-\_\-size} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap)
\begin{CompactList}\small\item\em Returns the size of the heap,. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
HEAP, interface file. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}CVS $Id
\end{verbatim}
\normalsize


\begin{Desc}
\item[Warning:]In their current state, these routines are not fit for Flight use. They can be used in studies. However they malloc all over the place and involve recursive calling techniques, neither of is appropriate for Flight code.\end{Desc}


\subsection{Typedef Documentation}
\hypertarget{HEAP_8h_a2}{
\index{HEAP.h@{HEAP.h}!HEAP@{HEAP}}
\index{HEAP@{HEAP}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__HEAP}{HEAP}}}
\label{HEAP_8h_a2}


Typedef for struct {\em \hyperlink{struct__HEAP}{\_\-HEAP}\/}. 

This structure is not meant to be directly manipulated by the user. It should be treated as a C++ private member\hypertarget{HEAP_8h_a0}{
\index{HEAP.h@{HEAP.h}!HEAP_compare@{HEAP\_\-compare}}
\index{HEAP_compare@{HEAP\_\-compare}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-compare]{\setlength{\rightskip}{0pt plus 5cm}int \hyperlink{HEAP_8h_a0}{HEAP\_\-compare}}}
\label{HEAP_8h_a0}


Comparison function used to sort the heap. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em $<$0}]if key1 $<$ key2 \item[{\em =0}]if key1 = key2 \item[{\em $>$0}]if key1 $>$ key2\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key1}]Pointer to the first data structure to be sorted \item[{\em key2}]Pointer to the second data structure to be sorted\end{description}
\end{Desc}
\hypertarget{HEAP_8h_a1}{
\index{HEAP.h@{HEAP.h}!HEAP_destroy@{HEAP\_\-destroy}}
\index{HEAP_destroy@{HEAP\_\-destroy}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-destroy]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{HEAP_8h_a1}{HEAP\_\-destroy}}}
\label{HEAP_8h_a1}


Call back function to destroy (freed) the data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The data to be destroyed (freed)\end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{HEAP_8h_a7}{
\index{HEAP.h@{HEAP.h}!HEAP__size@{HEAP\_\-\_\-size}}
\index{HEAP__size@{HEAP\_\-\_\-size}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-\_\-size]{\setlength{\rightskip}{0pt plus 5cm}HEAP\_\-\_\-size (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{HEAP_8h_a7}


Returns the size of the heap,. 

\begin{Desc}
\item[Returns:]The size of the heap, {\em i.e\/}. the number of nodes in the heap.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em heap}]The heap to size\end{description}
\end{Desc}
\hypertarget{HEAP_8h_a6}{
\index{HEAP.h@{HEAP.h}!HEAP_extract@{HEAP\_\-extract}}
\index{HEAP_extract@{HEAP\_\-extract}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-extract]{\setlength{\rightskip}{0pt plus 5cm}int HEAP\_\-extract (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap}, void $\ast$$\ast$ {\em data})}}
\label{HEAP_8h_a6}


Extracts (removes) the top node of the heap. 

\begin{Desc}
\item[Returns:]Status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em heap}]The heap to remove the node from \item[{\em data}]Returned as a pointer to the data associated with the node\end{description}
\end{Desc}
The return value is -1 if the heap is empty or an internal error occurs.\hypertarget{HEAP_8h_a4}{
\index{HEAP.h@{HEAP.h}!HEAP_free@{HEAP\_\-free}}
\index{HEAP_free@{HEAP\_\-free}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-free]{\setlength{\rightskip}{0pt plus 5cm}void HEAP\_\-free (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap})}}
\label{HEAP_8h_a4}


Frees all the nodes of the heap. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em heap}]The heap to free\end{description}
\end{Desc}
\hypertarget{HEAP_8h_a3}{
\index{HEAP.h@{HEAP.h}!HEAP_init@{HEAP\_\-init}}
\index{HEAP_init@{HEAP\_\-init}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void HEAP\_\-init (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap}, \hyperlink{HEAP_8h_a0}{HEAP\_\-compare} {\em compare}, \hyperlink{HEAP_8h_a1}{HEAP\_\-destroy} {\em destroy})}}
\label{HEAP_8h_a3}


Initializes a heap for use. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em heap}]The heap control structure to initialize \item[{\em compare}]Callback comparision routine \item[{\em destroy}]Callback destruction (free) routine\end{description}
\end{Desc}
\hypertarget{HEAP_8h_a5}{
\index{HEAP.h@{HEAP.h}!HEAP_insert@{HEAP\_\-insert}}
\index{HEAP_insert@{HEAP\_\-insert}!HEAP.h@{HEAP.h}}
\subsubsection[HEAP\_\-insert]{\setlength{\rightskip}{0pt plus 5cm}int HEAP\_\-insert (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap}, const void $\ast$ {\em data})}}
\label{HEAP_8h_a5}


Inserts a node with the specified data on the heap. 

\begin{Desc}
\item[Returns:]Status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em heap}]The heap to insert the node on \item[{\em data}]The data\end{description}
\end{Desc}
The only reason for failure is if the {\em heap\/} is specified as NULL