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

\subsection*{Classes}
\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_f7d17570e627f1459c18ab42904fa124}{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_cbdeefa70c8890779cf9eec3342268b4}{HEAP\_\-destroy} )(void $\ast$data)
\begin{CompactList}\small\item\em Call back function to destroy (freed) the data. \item\end{CompactList}\item 
typedef struct \hyperlink{struct__HEAP}{\_\-HEAP} \hyperlink{HEAP_8h_809ed4362bd1f87ddcd748896e6e138d}{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_d8125138ab980f9cc6a6879a4d7e5335}{HEAP\_\-init} (\hyperlink{struct__HEAP}{HEAP} $\ast$heap, \hyperlink{HEAP_8h_f7d17570e627f1459c18ab42904fa124}{HEAP\_\-compare} compare, \hyperlink{HEAP_8h_cbdeefa70c8890779cf9eec3342268b4}{HEAP\_\-destroy} destroy)
\begin{CompactList}\small\item\em Initializes a heap for use. \item\end{CompactList}\item 
void \hyperlink{HEAP_8h_d3a729ba4d2da01f71fbc25de7a3f65d}{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_31201925cc038c3f4ddb3e9640d28739}{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_9ae996825f0c9c6e710b3de4e7f6f5b1}{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_dea307a6355b8ef9fbdafd3fd589d380}{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_809ed4362bd1f87ddcd748896e6e138d}{
\index{HEAP.h@{HEAP.h}!HEAP@{HEAP}}
\index{HEAP@{HEAP}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf HEAP}}}
\label{HEAP_8h_809ed4362bd1f87ddcd748896e6e138d}


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_f7d17570e627f1459c18ab42904fa124}{
\index{HEAP.h@{HEAP.h}!HEAP_compare@{HEAP\_\-compare}}
\index{HEAP_compare@{HEAP\_\-compare}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf HEAP\_\-compare}}}
\label{HEAP_8h_f7d17570e627f1459c18ab42904fa124}


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_cbdeefa70c8890779cf9eec3342268b4}{
\index{HEAP.h@{HEAP.h}!HEAP_destroy@{HEAP\_\-destroy}}
\index{HEAP_destroy@{HEAP\_\-destroy}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf HEAP\_\-destroy}}}
\label{HEAP_8h_cbdeefa70c8890779cf9eec3342268b4}


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_dea307a6355b8ef9fbdafd3fd589d380}{
\index{HEAP.h@{HEAP.h}!HEAP__size@{HEAP\_\-\_\-size}}
\index{HEAP__size@{HEAP\_\-\_\-size}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}HEAP\_\-\_\-size ({\bf HEAP} $\ast$ {\em heap})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{HEAP_8h_dea307a6355b8ef9fbdafd3fd589d380}


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_9ae996825f0c9c6e710b3de4e7f6f5b1}{
\index{HEAP.h@{HEAP.h}!HEAP_extract@{HEAP\_\-extract}}
\index{HEAP_extract@{HEAP\_\-extract}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int HEAP\_\-extract ({\bf HEAP} $\ast$ {\em heap}, void $\ast$$\ast$ {\em data})}}
\label{HEAP_8h_9ae996825f0c9c6e710b3de4e7f6f5b1}


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_d3a729ba4d2da01f71fbc25de7a3f65d}{
\index{HEAP.h@{HEAP.h}!HEAP_free@{HEAP\_\-free}}
\index{HEAP_free@{HEAP\_\-free}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void HEAP\_\-free ({\bf HEAP} $\ast$ {\em heap})}}
\label{HEAP_8h_d3a729ba4d2da01f71fbc25de7a3f65d}


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_d8125138ab980f9cc6a6879a4d7e5335}{
\index{HEAP.h@{HEAP.h}!HEAP_init@{HEAP\_\-init}}
\index{HEAP_init@{HEAP\_\-init}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void HEAP\_\-init ({\bf HEAP} $\ast$ {\em heap}, {\bf HEAP\_\-compare} {\em compare}, {\bf HEAP\_\-destroy} {\em destroy})}}
\label{HEAP_8h_d8125138ab980f9cc6a6879a4d7e5335}


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_31201925cc038c3f4ddb3e9640d28739}{
\index{HEAP.h@{HEAP.h}!HEAP_insert@{HEAP\_\-insert}}
\index{HEAP_insert@{HEAP\_\-insert}!HEAP.h@{HEAP.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int HEAP\_\-insert ({\bf HEAP} $\ast$ {\em heap}, const void $\ast$ {\em data})}}
\label{HEAP_8h_31201925cc038c3f4ddb3e9640d28739}


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 