\doxysubsection{hashtable.\+h File Reference}
\label{hashtable_8h}\index{hashtable.h@{hashtable.h}}


A generic open addressing hashtable.  


Include dependency graph for hashtable.\+h\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=254pt]{hashtable_8h__incl}
\end{center}
\end{figure}
This graph shows which files directly or indirectly include this file\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{hashtable_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structhashtable}{hashtable}}
\begin{DoxyCompactList}\small\item\em The hashtable type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}}~\+\_\+\+JOIN(ENTRY, \+\_\+t)
\begin{DoxyCompactList}\small\item\em The entry type. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{hashtable_8h_a4ede5dc90f17fe0b2fa44430c8073d89}{KEY\+\_\+t}}~\+\_\+\+JOIN(KEY, \+\_\+t)
\begin{DoxyCompactList}\small\item\em The key type. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{hashtable_8h_a7b951012b0e11016cdcbee035a283be1}{MATCH\+\_\+t}}~\+\_\+\+JOIN(MATCH, \+\_\+t)
\begin{DoxyCompactList}\small\item\em The match type. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{hashtable_8h_af15ef27e505263cd8d9855c6bdbba940}{KEY\+\_\+hash}}~\+\_\+\+JOIN(KEY, \+\_\+hash)
\begin{DoxyCompactList}\small\item\em The key hash(k) method. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{hashtable_8h_a4b095b5dd8e8b80ad03e12e57b3c4e86}{MATCH\+\_\+cmp}}~\+\_\+\+JOIN(MATCH, \+\_\+cmp)
\begin{DoxyCompactList}\small\item\em The match cmp(m, e) method. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{hashtable_8h_a47f2e1a0db2093114b0cb6f161546238}{NAME\+\_\+new}}~\+\_\+\+JOIN(NAME, \+\_\+new)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a35cd78db510b66431761c259267339d7}{NAME\+\_\+free}}~\+\_\+\+JOIN(NAME, \+\_\+free)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a6106e89ce2a4d97fed1f89bfd7ce7dbe}{NAME\+\_\+stats\+\_\+init}}~\+\_\+\+JOIN(NAME, \+\_\+stats\+\_\+init)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a0e4a39d326c0a7efb30b90a3fd58fc8a}{NAME\+\_\+add}}~\+\_\+\+JOIN(NAME, \+\_\+add)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a4e34b211a187794bea3cccba003a7db4}{NAME\+\_\+find}}~\+\_\+\+JOIN(NAME, \+\_\+find)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a6d43a82bd182c0f1f761388a35dd26e6}{NAME\+\_\+iter}}~\+\_\+\+JOIN(NAME, \+\_\+iter)
\item 
\#define \mbox{\hyperlink{hashtable_8h_a5fcb3072bf943b8f4d7f681b934a97b4}{NAME\+\_\+next}}~\+\_\+\+JOIN(NAME, \+\_\+next)
\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \mbox{\hyperlink{structhashtable}{hashtable}} \mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}}
\begin{DoxyCompactList}\small\item\em The hashtable type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \mbox{\hyperlink{hashtable_8h_aa71741bf59dd582950ff7a311575c723}{hashtable\+\_\+setbloom}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, unsigned const h)
\item 
static bool \mbox{\hyperlink{hashtable_8h_a21e899dc5ce7d2657dfab606cfd5c058}{hashtable\+\_\+getbloom}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, unsigned const h)
\item 
static unsigned \mbox{\hyperlink{hashtable_8h_ac1bb2e17d20ca0fc08ab9e02ecaa698f}{mix32}} (unsigned h)
\begin{DoxyCompactList}\small\item\em Murmur\+Hash3 finalization mix function. \end{DoxyCompactList}\item 
static unsigned \mbox{\hyperlink{hashtable_8h_ad3e0c9c023060284c0e81ff95ff25979}{nozero}} (unsigned h)
\begin{DoxyCompactList}\small\item\em Ensure hash\textquotesingle{}s are never zero. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$ \mbox{\hyperlink{hashtable_8h_a72f00532020b20d176b57e60fe24c480}{NAME\+\_\+new}} (int size)
\begin{DoxyCompactList}\small\item\em Allocate and initialize a hashtable instance. \end{DoxyCompactList}\item 
static void \mbox{\hyperlink{hashtable_8h_a804ac6e8aad00085226b5605e6300abd}{NAME\+\_\+free}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t)
\begin{DoxyCompactList}\small\item\em Destroy and free a hashtable instance. \end{DoxyCompactList}\item 
static void \mbox{\hyperlink{hashtable_8h_a158adda1c5dd628b410c6c9f53ecdebf}{NAME\+\_\+stats\+\_\+init}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t)
\begin{DoxyCompactList}\small\item\em Initialize hashtable stats counters. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ \mbox{\hyperlink{hashtable_8h_a8f5751d4adbbec9c6b30848c951c14e7}{NAME\+\_\+add}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$e)
\begin{DoxyCompactList}\small\item\em Add an entry to a hashtable. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ \mbox{\hyperlink{hashtable_8h_a17bb9474643a3b0e36849e0faa1e8310}{NAME\+\_\+find}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, \mbox{\hyperlink{hashtable_8h_a7b951012b0e11016cdcbee035a283be1}{MATCH\+\_\+t}} $\ast$m)
\begin{DoxyCompactList}\small\item\em Find an entry in a hashtable. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ \mbox{\hyperlink{hashtable_8h_a3d6872fc0d32704681ab91bc95990f88}{NAME\+\_\+next}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, int $\ast$i)
\begin{DoxyCompactList}\small\item\em Get the next entry from a hashtable iterator or NULL when finished. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ \mbox{\hyperlink{hashtable_8h_a63414b4706a0821a88b77e44654ed879}{NAME\+\_\+iter}} (\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$t, int $\ast$i)
\begin{DoxyCompactList}\small\item\em Initialize a iteration and return the first entry. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}
A generic open addressing hashtable. 

This is a minimal hashtable containing pointers to arbitrary entries with configurable hashtable size and support for custom hash() and cmp() methods. The cmp() method can either be a simple comparison between two keys, or can be against a special match object containing additional mutable state. This allows for things like deferred and cached evaluation of costly comparison data. The hash() function doesn\textquotesingle{}t need to avoid clustering behaviour.

It uses open addressing with quadratic probing for collisions. The Murmur\+Hash3 finalization function is optionally used on the hash() output to avoid clustering and can be disabled by setting HASHTABLE\+\_\+\+NMIX32. There is no support for removing entries, only adding them. Multiple entries with the same key can be added, and you can use a fancy cmp() function to find particular entries by more than just their key. There is an iterator for iterating through all entries in the hashtable. There are optional \mbox{\hyperlink{hashtable_8h_a17bb9474643a3b0e36849e0faa1e8310}{NAME\+\_\+find()}} find/match/hashcmp/entrycmp stats counters that can be disabled by defining HASHTABLE\+\_\+\+NSTATS. There is an optional simple k=1 bloom filter for speed that can be disabled by defining HASHTABLE\+\_\+\+NBLOOM.

The types and methods of the hashtable and its contents are specified by using \#define parameters set to their basenames (the prefixes for the $\ast$\+\_\+t type and $\ast$\+\_\+func() methods) before doing \#include \char`\"{}hashtable.\+h\char`\"{}. This produces static inline type-\/safe methods that are either application optimized for speed or wrappers around void$\ast$ implementation methods for compactness.


\begin{DoxyParams}{Parameters}
{\em ENTRY} & -\/ the entry type basename.\\
\hline
{\em KEY} & -\/ optional key type basename (default\+: ENTRY).\\
\hline
{\em MATCH} & -\/ optional match type basename (default\+: KEY).\\
\hline
{\em NAME} & -\/ optional hashtable type basename (default\+: ENTRY\+\_\+hashtable).\\
\hline
\end{DoxyParams}
Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{typedef} ... mykey\_t;}
\DoxyCodeLine{\textcolor{keywordtype}{int} mykey\_hash(mykey\_t \textcolor{keyword}{const} *e);}
\DoxyCodeLine{\textcolor{keywordtype}{int} mykey\_cmp(mykey\_t *e, mykey\_t \textcolor{keyword}{const} *o);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }myentry \{}
\DoxyCodeLine{  mykey\_t key;  \textcolor{comment}{// Inherit from mykey\_t.}}
\DoxyCodeLine{  ...extra entry value data...}
\DoxyCodeLine{\} myentry\_t;}
\DoxyCodeLine{\textcolor{keywordtype}{void} myentry\_init(myentry\_t *e, ...);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define ENTRY myentry}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define KEY mykey}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "{}hashtable.h"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{hashtable\_t *t;}
\DoxyCodeLine{myentry\_t entries[300];}
\DoxyCodeLine{mykey\_t k;}
\DoxyCodeLine{myentry\_t *e;}
\DoxyCodeLine{}
\DoxyCodeLine{t = myentry\_hashtable\_new(300);}
\DoxyCodeLine{myentry\_init(\&entries[5], ...);}
\DoxyCodeLine{myentry\_hashtable\_add(t, \&entries[5]);}
\DoxyCodeLine{k = ...;}
\DoxyCodeLine{e = myentry\_hashtable\_find(t, \&k);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\textcolor{keywordflow}{for} (e = myentry\_hashtable\_iter(t, \&i); e != NULL;}
\DoxyCodeLine{     e = myentry\_hashtable\_next(t, \&i))}
\DoxyCodeLine{  ...}
\DoxyCodeLine{}
\DoxyCodeLine{myentry\_hashtable\_free(t);}

\end{DoxyCode}


The mykey\+\_\+hash() and mykey\+\_\+cmp() fuctions will typically take pointers to mykey/myentry instances the same as the pointers stored in the hashtable. However it is also possible for them to take \char`\"{}match objects\char`\"{} that are a \char`\"{}subclass\char`\"{} of the entry type that contain additional state for complicated comparision operations.

Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }mymatch \{}
\DoxyCodeLine{  mykey\_t key;  \textcolor{comment}{// Inherit from mykey\_t;}}
\DoxyCodeLine{  ...extra match criteria and state data...}
\DoxyCodeLine{\} mymatch\_t;}
\DoxyCodeLine{\textcolor{keywordtype}{int} mymatch\_cmp(mymatch\_t *m, myentry\_t \textcolor{keyword}{const} *e);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define ENTRY myentry}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define KEY mykey}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define MATCH mymatch}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "{}hashtable.h"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{...}
\DoxyCodeLine{mymatch\_t m;}
\DoxyCodeLine{}
\DoxyCodeLine{t = myentry\_hashtable\_new(300);}
\DoxyCodeLine{...}
\DoxyCodeLine{m = ...;}
\DoxyCodeLine{e = myentry\_hashtable\_find(t, \&m);}

\end{DoxyCode}


The mymatch\+\_\+cmp() function is only called for finding hashtable entries and can mutate the mymatch\+\_\+t object for doing things like deferred and cached evaluation of expensive match data. It can also access the whole myentry\+\_\+t object to match against more than just the key. 

Definition in file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.



\doxysubsubsection{Macro Definition Documentation}
\mbox{\label{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}} 
\index{hashtable.h@{hashtable.h}!ENTRY\_t@{ENTRY\_t}}
\index{ENTRY\_t@{ENTRY\_t}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{ENTRY\_t}{ENTRY\_t}}
{\footnotesize\ttfamily \#define ENTRY\+\_\+t~\+\_\+\+JOIN(ENTRY, \+\_\+t)}



The entry type. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00209}{209}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a4ede5dc90f17fe0b2fa44430c8073d89}} 
\index{hashtable.h@{hashtable.h}!KEY\_t@{KEY\_t}}
\index{KEY\_t@{KEY\_t}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{KEY\_t}{KEY\_t}}
{\footnotesize\ttfamily \#define KEY\+\_\+t~\+\_\+\+JOIN(KEY, \+\_\+t)}



The key type. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00210}{210}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a7b951012b0e11016cdcbee035a283be1}} 
\index{hashtable.h@{hashtable.h}!MATCH\_t@{MATCH\_t}}
\index{MATCH\_t@{MATCH\_t}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{MATCH\_t}{MATCH\_t}}
{\footnotesize\ttfamily \#define MATCH\+\_\+t~\+\_\+\+JOIN(MATCH, \+\_\+t)}



The match type. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00211}{211}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_af15ef27e505263cd8d9855c6bdbba940}} 
\index{hashtable.h@{hashtable.h}!KEY\_hash@{KEY\_hash}}
\index{KEY\_hash@{KEY\_hash}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{KEY\_hash}{KEY\_hash}}
{\footnotesize\ttfamily \#define KEY\+\_\+hash~\+\_\+\+JOIN(KEY, \+\_\+hash)}



The key hash(k) method. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00212}{212}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a4b095b5dd8e8b80ad03e12e57b3c4e86}} 
\index{hashtable.h@{hashtable.h}!MATCH\_cmp@{MATCH\_cmp}}
\index{MATCH\_cmp@{MATCH\_cmp}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{MATCH\_cmp}{MATCH\_cmp}}
{\footnotesize\ttfamily \#define MATCH\+\_\+cmp~\+\_\+\+JOIN(MATCH, \+\_\+cmp)}



The match cmp(m, e) method. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00213}{213}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a47f2e1a0db2093114b0cb6f161546238}} 
\index{hashtable.h@{hashtable.h}!NAME\_new@{NAME\_new}}
\index{NAME\_new@{NAME\_new}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_new}{NAME\_new}}
{\footnotesize\ttfamily \#define NAME\+\_\+new~\+\_\+\+JOIN(NAME, \+\_\+new)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00215}{215}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a35cd78db510b66431761c259267339d7}} 
\index{hashtable.h@{hashtable.h}!NAME\_free@{NAME\_free}}
\index{NAME\_free@{NAME\_free}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_free}{NAME\_free}}
{\footnotesize\ttfamily \#define NAME\+\_\+free~\+\_\+\+JOIN(NAME, \+\_\+free)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00216}{216}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a6106e89ce2a4d97fed1f89bfd7ce7dbe}} 
\index{hashtable.h@{hashtable.h}!NAME\_stats\_init@{NAME\_stats\_init}}
\index{NAME\_stats\_init@{NAME\_stats\_init}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_stats\_init}{NAME\_stats\_init}}
{\footnotesize\ttfamily \#define NAME\+\_\+stats\+\_\+init~\+\_\+\+JOIN(NAME, \+\_\+stats\+\_\+init)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00217}{217}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a0e4a39d326c0a7efb30b90a3fd58fc8a}} 
\index{hashtable.h@{hashtable.h}!NAME\_add@{NAME\_add}}
\index{NAME\_add@{NAME\_add}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_add}{NAME\_add}}
{\footnotesize\ttfamily \#define NAME\+\_\+add~\+\_\+\+JOIN(NAME, \+\_\+add)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00218}{218}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a4e34b211a187794bea3cccba003a7db4}} 
\index{hashtable.h@{hashtable.h}!NAME\_find@{NAME\_find}}
\index{NAME\_find@{NAME\_find}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_find}{NAME\_find}}
{\footnotesize\ttfamily \#define NAME\+\_\+find~\+\_\+\+JOIN(NAME, \+\_\+find)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00219}{219}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a6d43a82bd182c0f1f761388a35dd26e6}} 
\index{hashtable.h@{hashtable.h}!NAME\_iter@{NAME\_iter}}
\index{NAME\_iter@{NAME\_iter}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_iter}{NAME\_iter}}
{\footnotesize\ttfamily \#define NAME\+\_\+iter~\+\_\+\+JOIN(NAME, \+\_\+iter)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00220}{220}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a5fcb3072bf943b8f4d7f681b934a97b4}} 
\index{hashtable.h@{hashtable.h}!NAME\_next@{NAME\_next}}
\index{NAME\_next@{NAME\_next}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_next}{NAME\_next}}
{\footnotesize\ttfamily \#define NAME\+\_\+next~\+\_\+\+JOIN(NAME, \+\_\+next)}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00221}{221}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.



\doxysubsubsection{Typedef Documentation}
\mbox{\label{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}} 
\index{hashtable.h@{hashtable.h}!hashtable\_t@{hashtable\_t}}
\index{hashtable\_t@{hashtable\_t}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{hashtable\_t}{hashtable\_t}}
{\footnotesize\ttfamily typedef struct \mbox{\hyperlink{structhashtable}{hashtable}} \mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}}}



The hashtable type. 



\doxysubsubsection{Function Documentation}
\mbox{\label{hashtable_8h_aa71741bf59dd582950ff7a311575c723}} 
\index{hashtable.h@{hashtable.h}!hashtable\_setbloom@{hashtable\_setbloom}}
\index{hashtable\_setbloom@{hashtable\_setbloom}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{hashtable\_setbloom()}{hashtable\_setbloom()}}
{\footnotesize\ttfamily static void hashtable\+\_\+setbloom (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{unsigned const}]{h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00154}{154}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a21e899dc5ce7d2657dfab606cfd5c058}} 
\index{hashtable.h@{hashtable.h}!hashtable\_getbloom@{hashtable\_getbloom}}
\index{hashtable\_getbloom@{hashtable\_getbloom}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{hashtable\_getbloom()}{hashtable\_getbloom()}}
{\footnotesize\ttfamily static bool hashtable\+\_\+getbloom (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{unsigned const}]{h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00161}{161}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_ac1bb2e17d20ca0fc08ab9e02ecaa698f}} 
\index{hashtable.h@{hashtable.h}!mix32@{mix32}}
\index{mix32@{mix32}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{mix32()}{mix32()}}
{\footnotesize\ttfamily static unsigned mix32 (\begin{DoxyParamCaption}\item[{unsigned}]{h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Murmur\+Hash3 finalization mix function. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00170}{170}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_ad3e0c9c023060284c0e81ff95ff25979}} 
\index{hashtable.h@{hashtable.h}!nozero@{nozero}}
\index{nozero@{nozero}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{nozero()}{nozero()}}
{\footnotesize\ttfamily static unsigned nozero (\begin{DoxyParamCaption}\item[{unsigned}]{h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Ensure hash\textquotesingle{}s are never zero. 



Definition at line \mbox{\hyperlink{hashtable_8h_source_l00181}{181}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a72f00532020b20d176b57e60fe24c480}} 
\index{hashtable.h@{hashtable.h}!NAME\_new@{NAME\_new}}
\index{NAME\_new@{NAME\_new}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_new()}{NAME\_new()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$ NAME\+\_\+new (\begin{DoxyParamCaption}\item[{int}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocate and initialize a hashtable instance. 

The provided size is used as an indication of the number of entries you wish to add, but the allocated size will probably be larger depending on the implementation to enable optimisations or avoid degraded performance. It may be possible to fill the table beyond the requested size, but performance can start to degrade badly if it is over filled.


\begin{DoxyParams}{Parameters}
{\em size} & -\/ The desired minimum size of the hash table.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The initialized hashtable instance or NULL if it failed. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00256}{256}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a804ac6e8aad00085226b5605e6300abd}} 
\index{hashtable.h@{hashtable.h}!NAME\_free@{NAME\_free}}
\index{NAME\_free@{NAME\_free}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_free()}{NAME\_free()}}
{\footnotesize\ttfamily static void NAME\+\_\+free (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Destroy and free a hashtable instance. 

This will free the hashtable, but will not free the entries in the hashtable. If you want to free the entries too, use a hashtable iterator to free the the entries first.


\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ The hashtable to destroy and free. \\
\hline
\end{DoxyParams}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00268}{268}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a158adda1c5dd628b410c6c9f53ecdebf}} 
\index{hashtable.h@{hashtable.h}!NAME\_stats\_init@{NAME\_stats\_init}}
\index{NAME\_stats\_init@{NAME\_stats\_init}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_stats\_init()}{NAME\_stats\_init()}}
{\footnotesize\ttfamily static void NAME\+\_\+stats\+\_\+init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Initialize hashtable stats counters. 

This will reset all the stats counters for the hashtable,


\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ The hashtable to initializ stats for. \\
\hline
\end{DoxyParams}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00278}{278}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a8f5751d4adbbec9c6b30848c951c14e7}} 
\index{hashtable.h@{hashtable.h}!NAME\_add@{NAME\_add}}
\index{NAME\_add@{NAME\_add}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_add()}{NAME\_add()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ NAME\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{\mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$}]{e }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Add an entry to a hashtable. 

This doesn\textquotesingle{}t use \mbox{\hyperlink{hashtable_8h_a4b095b5dd8e8b80ad03e12e57b3c4e86}{MATCH\+\_\+cmp()}} or do any checks for existing copies or instances, so it will add duplicates. If you want to avoid adding duplicates, use \mbox{\hyperlink{hashtable_8h_a17bb9474643a3b0e36849e0faa1e8310}{NAME\+\_\+find()}} to check for existing entries first.


\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ The hashtable to add to.\\
\hline
{\em $\ast$e} & -\/ The entry object to add.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The added entry, or NULL if the table is full. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00296}{296}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a17bb9474643a3b0e36849e0faa1e8310}} 
\index{hashtable.h@{hashtable.h}!NAME\_find@{NAME\_find}}
\index{NAME\_find@{NAME\_find}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_find()}{NAME\_find()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ NAME\+\_\+find (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{\mbox{\hyperlink{hashtable_8h_a7b951012b0e11016cdcbee035a283be1}{MATCH\+\_\+t}} $\ast$}]{m }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Find an entry in a hashtable. 

Uses \mbox{\hyperlink{hashtable_8h_a4b095b5dd8e8b80ad03e12e57b3c4e86}{MATCH\+\_\+cmp()}} to find the first matching entry in the table in the same hash() bucket.


\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ The hashtable to search.\\
\hline
{\em $\ast$m} & -\/ The key or match object to search for.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The first found entry, or NULL if nothing was found. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00322}{322}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a3d6872fc0d32704681ab91bc95990f88}} 
\index{hashtable.h@{hashtable.h}!NAME\_next@{NAME\_next}}
\index{NAME\_next@{NAME\_next}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_next()}{NAME\_next()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ NAME\+\_\+next (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{int $\ast$}]{i }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the next entry from a hashtable iterator or NULL when finished. 

This works together with \mbox{\hyperlink{hashtable_8h_a63414b4706a0821a88b77e44654ed879}{NAME\+\_\+iter()}} for iterating through all entries in a hashtable.


\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ the hashtable to iterate over.\\
\hline
{\em $\ast$i} & -\/ the int iterator index to use.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The next entry or NULL if the iterator is finished. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00383}{383}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

\mbox{\label{hashtable_8h_a63414b4706a0821a88b77e44654ed879}} 
\index{hashtable.h@{hashtable.h}!NAME\_iter@{NAME\_iter}}
\index{NAME\_iter@{NAME\_iter}!hashtable.h@{hashtable.h}}
\doxyparagraph{\texorpdfstring{NAME\_iter()}{NAME\_iter()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{hashtable_8h_a0b465aad0dbee94f1c2885f803e47b08}{ENTRY\+\_\+t}} $\ast$ NAME\+\_\+iter (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{hashtable_8h_a73b7b0b1854d7b8336d3168aaa8fe755}{hashtable\+\_\+t}} $\ast$}]{t,  }\item[{int $\ast$}]{i }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Initialize a iteration and return the first entry. 

This works together with \mbox{\hyperlink{hashtable_8h_a3d6872fc0d32704681ab91bc95990f88}{NAME\+\_\+next()}} for iterating through all entries in a hashtable.

Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{for} (e = NAME\_iter(t, \&i); e != NULL; e = NAME\_next(t, \&i))}
\DoxyCodeLine{  ...}

\end{DoxyCode}



\begin{DoxyParams}{Parameters}
{\em $\ast$t} & -\/ the hashtable to iterate over.\\
\hline
{\em $\ast$i} & -\/ the int iterator index to initialize.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The first entry or NULL if the hashtable is empty. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{hashtable_8h_source_l00365}{365}} of file \mbox{\hyperlink{hashtable_8h_source}{hashtable.\+h}}.

