\hypertarget{hashtable_8h_source}{}\doxysection{hashtable.\+h}
\label{hashtable_8h_source}\index{include/toolbox/hashtable.h@{include/toolbox/hashtable.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#ifndef TOOLBOX\_HASHTABLE\_H}}
\DoxyCodeLine{2 \textcolor{preprocessor}{\#define TOOLBOX\_HASHTABLE\_H}}
\DoxyCodeLine{3 }
\DoxyCodeLine{4 \textcolor{preprocessor}{\#include "{}toolbox/return\_codes.h"{}}}
\DoxyCodeLine{5 }
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <stdbool.h>}}
\DoxyCodeLine{7 \textcolor{preprocessor}{\#include <stddef.h>}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{9 }
\DoxyCodeLine{10 \textcolor{preprocessor}{\#ifndef HASHTABLE\_SIZE\_BYTES}}
\DoxyCodeLine{11 \textcolor{preprocessor}{\#define HASHTABLE\_SIZE\_BYTES (1024*1024)}}
\DoxyCodeLine{12 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{13 }
\DoxyCodeLine{14 \textcolor{preprocessor}{\#ifdef TOOLBOX\_TYPEDEF}}
\DoxyCodeLine{15 \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\mbox{\hyperlink{structhashtable}{hashtable}} hashtable\_st;}
\DoxyCodeLine{16 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{17 }
\DoxyCodeLine{18 \textcolor{keyword}{struct }\mbox{\hyperlink{structhashtable}{hashtable}};}
\DoxyCodeLine{19 }
\DoxyCodeLine{20 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{21 \textcolor{keyword}{struct }\mbox{\hyperlink{structhashtable}{hashtable}} *}
\DoxyCodeLine{22 hashtable\_create(\textcolor{keywordtype}{void});}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 RET\_TYPE}
\DoxyCodeLine{25 hashtable\_destroy(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} **self);}
\DoxyCodeLine{26 }
\DoxyCodeLine{27 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{28 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{29 hashtable\_contain\_item(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{30                         , \textcolor{keyword}{const} \textcolor{keywordtype}{void}* item, \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_size);}
\DoxyCodeLine{31 }
\DoxyCodeLine{32 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{33 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{34 hashtable\_contain\_key(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{35                        , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key);}
\DoxyCodeLine{36 }
\DoxyCodeLine{37 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{38 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{39 hashtable\_contain\_key\_hash(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{40                             , \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} key\_hash);}
\DoxyCodeLine{41 }
\DoxyCodeLine{42 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{43 \textcolor{keyword}{const} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{44 hashtable\_get(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{45               , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key);}
\DoxyCodeLine{46 }
\DoxyCodeLine{47 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{48 \textcolor{keyword}{const} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{49 hashtable\_get\_or\_default(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{50                          , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key}
\DoxyCodeLine{51                          , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *default\_item);}
\DoxyCodeLine{52 }
\DoxyCodeLine{53 \_\_attribute\_\_((\_\_pure\_\_))}
\DoxyCodeLine{54 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{55 hashtable\_is\_empty(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self);}
\DoxyCodeLine{56 }
\DoxyCodeLine{57 RET\_TYPE}
\DoxyCodeLine{58 hashtable\_put(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{59               , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key}
\DoxyCodeLine{60               , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *item, \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_size);}
\DoxyCodeLine{61 }
\DoxyCodeLine{62 \textcolor{keyword}{const} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{63 hashtable\_remove(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key);}
\DoxyCodeLine{64 }
\DoxyCodeLine{65 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{66 hashtable\_remove\_if\_equal(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{67                           , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key}
\DoxyCodeLine{68                           , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *item, \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_size);}
\DoxyCodeLine{69 }
\DoxyCodeLine{70 \textcolor{keyword}{const} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{71 hashtable\_replace(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{72                   , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key}
\DoxyCodeLine{73                   , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *item, \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_size);}
\DoxyCodeLine{74 }
\DoxyCodeLine{75 \textcolor{keywordtype}{bool}}
\DoxyCodeLine{76 hashtable\_replace\_if\_equal(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{77                            , \textcolor{keyword}{const} \textcolor{keywordtype}{char} *key}
\DoxyCodeLine{78                            , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *restrict old\_item}
\DoxyCodeLine{79                            , \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_old\_size}
\DoxyCodeLine{80                            , \textcolor{keyword}{const} \textcolor{keywordtype}{void} *restrict new\_item}
\DoxyCodeLine{81                            , \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} item\_new\_size);}
\DoxyCodeLine{82 }
\DoxyCodeLine{83 \textcolor{keywordtype}{size\_t}}
\DoxyCodeLine{84 hashtable\_used\_size(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self);}
\DoxyCodeLine{85 }
\DoxyCodeLine{86 RET\_TYPE}
\DoxyCodeLine{87 hashtable\_for\_each(\textcolor{keyword}{struct} \mbox{\hyperlink{structhashtable}{hashtable}} *self}
\DoxyCodeLine{88                    , \textcolor{keywordtype}{void} (*for\_each)(\textcolor{keywordtype}{void} *item, \textcolor{keywordtype}{size\_t} *item\_size));}
\DoxyCodeLine{89 }
\DoxyCodeLine{90 \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
