2006-03-04 18:16:49 +00:00
|
|
|
#ifndef HEADER_Hashtable
|
|
|
|
#define HEADER_Hashtable
|
|
|
|
/*
|
2011-12-26 21:35:57 +00:00
|
|
|
htop - Hashtable.h
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2021-09-22 09:33:00 +00:00
|
|
|
Released under the GNU GPLv2+, see the COPYING file
|
2006-03-04 18:16:49 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2021-01-04 22:25:28 +00:00
|
|
|
#include <stddef.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
|
2021-01-04 22:20:36 +00:00
|
|
|
typedef unsigned int ht_key_t;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2021-01-04 22:20:36 +00:00
|
|
|
typedef void(*Hashtable_PairFunction)(ht_key_t key, void* value, void* userdata);
|
2020-10-21 19:25:59 +00:00
|
|
|
|
2021-01-04 22:21:54 +00:00
|
|
|
typedef struct Hashtable_ Hashtable;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-17 20:27:33 +00:00
|
|
|
#ifndef NDEBUG
|
2006-11-12 21:52:14 +00:00
|
|
|
|
2021-01-04 22:25:28 +00:00
|
|
|
size_t Hashtable_count(const Hashtable* this);
|
2006-11-12 21:52:14 +00:00
|
|
|
|
2020-09-17 20:27:33 +00:00
|
|
|
#endif /* NDEBUG */
|
2006-11-12 21:52:14 +00:00
|
|
|
|
2021-01-04 22:25:28 +00:00
|
|
|
Hashtable* Hashtable_new(size_t size, bool owner);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void Hashtable_delete(Hashtable* this);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-11-29 13:54:10 +00:00
|
|
|
void Hashtable_clear(Hashtable* this);
|
|
|
|
|
2021-01-04 22:25:28 +00:00
|
|
|
void Hashtable_setSize(Hashtable* this, size_t size);
|
2020-10-22 13:43:26 +00:00
|
|
|
|
2021-01-04 22:20:36 +00:00
|
|
|
void Hashtable_put(Hashtable* this, ht_key_t key, void* value);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2021-01-04 22:20:36 +00:00
|
|
|
void* Hashtable_remove(Hashtable* this, ht_key_t key);
|
2006-11-12 21:52:14 +00:00
|
|
|
|
2021-01-04 22:20:36 +00:00
|
|
|
void* Hashtable_get(Hashtable* this, ht_key_t key);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void Hashtable_foreach(Hashtable* this, Hashtable_PairFunction f, void* userData);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#endif
|