\section{oggz\_\-table.h File Reference}
\label{oggz__table_8h}\index{oggz\_\-table.h@{oggz\_\-table.h}}


A lookup table.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef void {\bf OggzTable}\label{oggz__table_8h_a72c5d21d2254089d192176e1c310b023}

\begin{DoxyCompactList}\small\item\em A table of key-\/value pairs. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
{\bf OggzTable} $\ast$ {\bf oggz\_\-table\_\-new} (void)
\begin{DoxyCompactList}\small\item\em Instantiate a new OggzTable. \item\end{DoxyCompactList}\item 
void {\bf oggz\_\-table\_\-delete} ({\bf OggzTable} $\ast$table)
\begin{DoxyCompactList}\small\item\em Delete an OggzTable. \item\end{DoxyCompactList}\item 
void $\ast$ {\bf oggz\_\-table\_\-insert} ({\bf OggzTable} $\ast$table, long key, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Insert an element into a table. \item\end{DoxyCompactList}\item 
int {\bf oggz\_\-table\_\-remove} ({\bf OggzTable} $\ast$table, long key)
\begin{DoxyCompactList}\small\item\em Remove the element of an OggzTable indexed by a given key. \item\end{DoxyCompactList}\item 
void $\ast$ {\bf oggz\_\-table\_\-lookup} ({\bf OggzTable} $\ast$table, long key)
\begin{DoxyCompactList}\small\item\em Retrieve the element of an OggzTable indexed by a given key. \item\end{DoxyCompactList}\item 
int {\bf oggz\_\-table\_\-size} ({\bf OggzTable} $\ast$table)
\begin{DoxyCompactList}\small\item\em Query the number of elements in an OggzTable. \item\end{DoxyCompactList}\item 
void $\ast$ {\bf oggz\_\-table\_\-nth} ({\bf OggzTable} $\ast$table, int n, long $\ast$key)
\begin{DoxyCompactList}\small\item\em Retrieve the nth element of an OggzTable, and optionally its key. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
A lookup table. OggzTable is provided for convenience to allow the storage of serialno-\/specific data. 

\subsection{Function Documentation}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-delete@{oggz\_\-table\_\-delete}}
\index{oggz\_\-table\_\-delete@{oggz\_\-table\_\-delete}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-delete}]{\setlength{\rightskip}{0pt plus 5cm}void oggz\_\-table\_\-delete ({\bf OggzTable} $\ast$ {\em table})}\label{oggz__table_8h_a989e307feecf2adc2ebe905c067051c4}


Delete an OggzTable. 


\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \end{DoxyParams}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-insert@{oggz\_\-table\_\-insert}}
\index{oggz\_\-table\_\-insert@{oggz\_\-table\_\-insert}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-insert}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ oggz\_\-table\_\-insert ({\bf OggzTable} $\ast$ {\em table}, \/  long {\em key}, \/  void $\ast$ {\em data})}\label{oggz__table_8h_adbcdb0cdf6e8392c78956e911cbf6634}


Insert an element into a table. 

If a previous value existed for this key, it is overwritten with the new data element. 
\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \item[{\em key}]Key to access this data element \item[{\em data}]The new element to add \end{DoxyParams}

\begin{DoxyRetVals}{Return values}
\item[{\em data}]If the element was successfully added \item[{\em NULL}]If adding the element failed due to a realloc() error \end{DoxyRetVals}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-lookup@{oggz\_\-table\_\-lookup}}
\index{oggz\_\-table\_\-lookup@{oggz\_\-table\_\-lookup}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-lookup}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ oggz\_\-table\_\-lookup ({\bf OggzTable} $\ast$ {\em table}, \/  long {\em key})}\label{oggz__table_8h_a92ea55bffd5657be29cf1972f33364e3}


Retrieve the element of an OggzTable indexed by a given key. 


\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \item[{\em key}]a key \end{DoxyParams}
\begin{DoxyReturn}{Returns}
The element indexed by {\itshape key\/} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
\item[{\em NULL}]{\itshape table\/} is undefined, or no element is indexed by {\itshape key\/} \end{DoxyRetVals}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-new@{oggz\_\-table\_\-new}}
\index{oggz\_\-table\_\-new@{oggz\_\-table\_\-new}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-new}]{\setlength{\rightskip}{0pt plus 5cm}{\bf OggzTable}$\ast$ oggz\_\-table\_\-new (void)}\label{oggz__table_8h_a40772505443484de93526882c48f0dd8}


Instantiate a new OggzTable. 

\begin{DoxyReturn}{Returns}
A new OggzTable 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
\item[{\em NULL}]Could not allocate memory for table \end{DoxyRetVals}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-nth@{oggz\_\-table\_\-nth}}
\index{oggz\_\-table\_\-nth@{oggz\_\-table\_\-nth}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-nth}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ oggz\_\-table\_\-nth ({\bf OggzTable} $\ast$ {\em table}, \/  int {\em n}, \/  long $\ast$ {\em key})}\label{oggz__table_8h_a285c3cbdb46e9b8c2a831728182856f1}


Retrieve the nth element of an OggzTable, and optionally its key. 


\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \item[{\em n}]An index into the {\itshape table\/} \item[{\em key}]Return pointer for key corresponding to nth data element of {\itshape table\/}. Ignored if NULL. \end{DoxyParams}
\begin{DoxyReturn}{Returns}
The nth data element of {\itshape table\/} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
\item[{\em NULL}]{\itshape table\/} is undefined, or {\itshape n\/} is out of range \end{DoxyRetVals}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-remove@{oggz\_\-table\_\-remove}}
\index{oggz\_\-table\_\-remove@{oggz\_\-table\_\-remove}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-remove}]{\setlength{\rightskip}{0pt plus 5cm}int oggz\_\-table\_\-remove ({\bf OggzTable} $\ast$ {\em table}, \/  long {\em key})}\label{oggz__table_8h_ac137e535f1da63ee52266b47f114020f}


Remove the element of an OggzTable indexed by a given key. 


\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \item[{\em key}]a key \end{DoxyParams}

\begin{DoxyRetVals}{Return values}
\item[{\em 0}]Success \item[{\em -\/1}]Not found \end{DoxyRetVals}
\index{oggz\_\-table.h@{oggz\_\-table.h}!oggz\_\-table\_\-size@{oggz\_\-table\_\-size}}
\index{oggz\_\-table\_\-size@{oggz\_\-table\_\-size}!oggz_table.h@{oggz\_\-table.h}}
\subsubsection[{oggz\_\-table\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}int oggz\_\-table\_\-size ({\bf OggzTable} $\ast$ {\em table})}\label{oggz__table_8h_a62db2037df45db88a75b89b8a8ac7766}


Query the number of elements in an OggzTable. 


\begin{DoxyParams}{Parameters}
\item[{\em table}]An OggzTable \end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of elements in {\itshape table\/} 
\end{DoxyReturn}
