Hashtable.h 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef HEADER_Hashtable
  2. #define HEADER_Hashtable
  3. /*
  4. htop - Hashtable.h
  5. (C) 2004-2011 Hisham H. Muhammad
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <stdbool.h>
  10. #include <stddef.h>
  11. typedef unsigned int ht_key_t;
  12. typedef void(*Hashtable_PairFunction)(ht_key_t key, void* value, void* userdata);
  13. typedef struct Hashtable_ Hashtable;
  14. #ifndef NDEBUG
  15. size_t Hashtable_count(const Hashtable* this);
  16. #endif /* NDEBUG */
  17. Hashtable* Hashtable_new(size_t size, bool owner);
  18. void Hashtable_delete(Hashtable* this);
  19. void Hashtable_clear(Hashtable* this);
  20. void Hashtable_setSize(Hashtable* this, size_t size);
  21. void Hashtable_put(Hashtable* this, ht_key_t key, void* value);
  22. void* Hashtable_remove(Hashtable* this, ht_key_t key);
  23. void* Hashtable_get(Hashtable* this, ht_key_t key);
  24. void Hashtable_foreach(Hashtable* this, Hashtable_PairFunction f, void* userData);
  25. #endif