From d3c9975943df58e293359b87905d19ff1fd52061 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:15 +0200 Subject: Imported Upstream version 0.5 --- Hashtable.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Hashtable.h (limited to 'Hashtable.h') diff --git a/Hashtable.h b/Hashtable.h new file mode 100644 index 0000000..e031cbe --- /dev/null +++ b/Hashtable.h @@ -0,0 +1,55 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Hashtable +#define HEADER_Hashtable +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + + +#include +#include + +#include "debug.h" + +typedef struct Hashtable_ Hashtable; + +typedef void(*HashtablePairFunction)(int, void*); +typedef int(*HashtableHashAlgorithm)(Hashtable*, int); + +typedef struct HashtableItem { + int key; + void* value; + struct HashtableItem* next; +} HashtableItem; + +struct Hashtable_ { + int size; + HashtableItem** buckets; + int items; + HashtableHashAlgorithm hashAlgorithm; + bool owner; +}; + +HashtableItem* HashtableItem_new(int key, void* value); + +Hashtable* Hashtable_new(int size, bool owner); + +int Hashtable_hashAlgorithm(Hashtable* this, int key); + +void Hashtable_delete(Hashtable* this); + +inline int Hashtable_size(Hashtable* this); + +void Hashtable_put(Hashtable* this, int key, void* value); + +void* Hashtable_remove(Hashtable* this, int key); + +inline void* Hashtable_get(Hashtable* this, int key); + +void Hashtable_foreach(Hashtable* this, HashtablePairFunction f); + +#endif -- cgit v1.2.3