\hypertarget{HEAP_8c}{
\section{HEAP.c File Reference}
\label{HEAP_8c}\index{HEAP.c@{HEAP.c}}
}
HEAP, implementation file. 

{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include \char`\"{}LDT/HEAP.h\char`\"{}}\par


Include dependency graph for HEAP.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=108pt]{HEAP_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{HEAP_8c_a0}{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_8c_a1}{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_8c_a2}{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_8c_a3}{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}\end{CompactItemize}


\subsection{Detailed Description}
HEAP, implementation 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{Function Documentation}
\hypertarget{HEAP_8c_a3}{
\index{HEAP.c@{HEAP.c}!HEAP_extract@{HEAP\_\-extract}}
\index{HEAP_extract@{HEAP\_\-extract}!HEAP.c@{HEAP.c}}
\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_8c_a3}


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_8c_a1}{
\index{HEAP.c@{HEAP.c}!HEAP_free@{HEAP\_\-free}}
\index{HEAP_free@{HEAP\_\-free}!HEAP.c@{HEAP.c}}
\subsubsection[HEAP\_\-free]{\setlength{\rightskip}{0pt plus 5cm}HEAP\_\-free (\hyperlink{struct__HEAP}{HEAP} $\ast$ {\em heap})}}
\label{HEAP_8c_a1}


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_8c_a0}{
\index{HEAP.c@{HEAP.c}!HEAP_init@{HEAP\_\-init}}
\index{HEAP_init@{HEAP\_\-init}!HEAP.c@{HEAP.c}}
\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_8c_a0}


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_8c_a2}{
\index{HEAP.c@{HEAP.c}!HEAP_insert@{HEAP\_\-insert}}
\index{HEAP_insert@{HEAP\_\-insert}!HEAP.c@{HEAP.c}}
\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_8c_a2}


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