diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2006-03-04 18:16:49 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2006-03-04 18:16:49 +0000 |
commit | d6231bab89d634da5564491196b7c478db038505 (patch) | |
tree | bfc0bf00b138763eb41132fd27a8f389a78bf3a4 /Hashtable.h |
Initial import.
Diffstat (limited to 'Hashtable.h')
-rw-r--r-- | Hashtable.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Hashtable.h b/Hashtable.h new file mode 100644 index 00000000..51d8704e --- /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-2006 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + + +#include <stdlib.h> +#include <stdbool.h> + +#include "debug.h" + +typedef struct Hashtable_ Hashtable; + +typedef void(*Hashtable_PairFunction)(int, void*, void*); +typedef int(*Hashtable_HashAlgorithm)(Hashtable*, int); + +typedef struct HashtableItem { + int key; + void* value; + struct HashtableItem* next; +} HashtableItem; + +struct Hashtable_ { + int size; + HashtableItem** buckets; + int items; + Hashtable_HashAlgorithm 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, Hashtable_PairFunction f, void* userData); + +#endif |