\doxysection{oggz\+\_\+table.\+h File Reference}
\label{oggz__table_8h}\index{oggz\_table.h@{oggz\_table.h}}


A lookup table.  


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


\doxysubsection{Detailed Description}
A lookup table. 

\doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} is provided for convenience to allow the storage of serialno-\/specific data. 

\doxysubsection{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}}
\doxysubsubsection{oggz\_table\_delete()}
{\footnotesize\ttfamily \label{oggz__table_8h_a989e307feecf2adc2ebe905c067051c4} 
void oggz\+\_\+table\+\_\+delete (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{}\end{DoxyParamCaption})}



Delete an \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023}. 


\begin{DoxyParams}{Parameters}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_insert()}
{\footnotesize\ttfamily \label{oggz__table_8h_aa30b0b56ad5ff74df51555cfa604efef} 
void $\ast$ oggz\+\_\+table\+\_\+insert (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{, }\item[{long}]{key}{, }\item[{void $\ast$}]{data}{}\end{DoxyParamCaption})}



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}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
{\em key} & Key to access this data element \\
\hline
{\em data} & The new element to add \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em data} & If the element was successfully added \\
\hline
{\em NULL} & If adding the element failed due to a realloc() error \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_lookup()}
{\footnotesize\ttfamily \label{oggz__table_8h_ae3889007114572539dc4b9f7af303a55} 
void $\ast$ oggz\+\_\+table\+\_\+lookup (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{, }\item[{long}]{key}{}\end{DoxyParamCaption})}



Retrieve the element of an \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} indexed by a given key. 


\begin{DoxyParams}{Parameters}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
{\em key} & a key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The element indexed by {\itshape key} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & {\itshape table} is undefined, or no element is indexed by {\itshape key} \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_new()}
{\footnotesize\ttfamily \label{oggz__table_8h_a696dcf90e8afa9ffeff845c292afc8a8} 
\textbf{ Oggz\+Table} $\ast$ oggz\+\_\+table\+\_\+new (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



Instantiate a new \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023}. 

\begin{DoxyReturn}{Returns}
A new \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & Could not allocate memory for table \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_nth()}
{\footnotesize\ttfamily \label{oggz__table_8h_a96f2a020f9b834694f03e31d019f80b5} 
void $\ast$ oggz\+\_\+table\+\_\+nth (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{, }\item[{int}]{n}{, }\item[{long $\ast$}]{key}{}\end{DoxyParamCaption})}



Retrieve the nth element of an \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023}, and optionally its key. 


\begin{DoxyParams}{Parameters}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
{\em n} & An index into the {\itshape table} \\
\hline
{\em key} & Return pointer for key corresponding to nth data element of {\itshape table}. Ignored if NULL. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The nth data element of {\itshape table} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & {\itshape table} is undefined, or {\itshape n} is out of range \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_remove()}
{\footnotesize\ttfamily \label{oggz__table_8h_ac137e535f1da63ee52266b47f114020f} 
int oggz\+\_\+table\+\_\+remove (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{, }\item[{long}]{key}{}\end{DoxyParamCaption})}



Remove the element of an \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} indexed by a given key. 


\begin{DoxyParams}{Parameters}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
{\em key} & a key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & Success \\
\hline
{\em -\/1} & Not found \\
\hline
\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}}
\doxysubsubsection{oggz\_table\_size()}
{\footnotesize\ttfamily \label{oggz__table_8h_a62db2037df45db88a75b89b8a8ac7766} 
int oggz\+\_\+table\+\_\+size (\begin{DoxyParamCaption}\item[{\textbf{ Oggz\+Table} $\ast$}]{table}{}\end{DoxyParamCaption})}



Query the number of elements in an \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023}. 


\begin{DoxyParams}{Parameters}
{\em table} & An \doxyref{Oggz\+Table}{p.}{oggz__table_8h_a72c5d21d2254089d192176e1c310b023} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of elements in {\itshape table} 
\end{DoxyReturn}
