diff options
author | Joseph Botosh <rumly111@gmail.com> | 2016-06-13 15:31:44 +0300 |
---|---|---|
committer | Joseph Botosh <rumly111@gmail.com> | 2016-06-15 02:17:45 +0300 |
commit | 38c20e9b5992fff9239fb17ee8cd8cc262d2d439 (patch) | |
tree | e793271505c9cf8cdfbd14aaca8f865b53d51fa1 /src/emap/hashtable.h | |
parent | 54c9c5edbc0b134faa3ddd37dd2bfdfc9a3fec41 (diff) | |
download | evol-hercules-38c20e9b5992fff9239fb17ee8cd8cc262d2d439.tar.gz evol-hercules-38c20e9b5992fff9239fb17ee8cd8cc262d2d439.tar.bz2 evol-hercules-38c20e9b5992fff9239fb17ee8cd8cc262d2d439.tar.xz evol-hercules-38c20e9b5992fff9239fb17ee8cd8cc262d2d439.zip |
add hashtable functions
htnew, htdelete, htput, htget, htclear, htsize
htiterator, htinextkey, hticheck, htidelete
Diffstat (limited to 'src/emap/hashtable.h')
-rw-r--r-- | src/emap/hashtable.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/emap/hashtable.h b/src/emap/hashtable.h new file mode 100644 index 0000000..44712cd --- /dev/null +++ b/src/emap/hashtable.h @@ -0,0 +1,43 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2015 - 2016 Evol developers + +#ifndef EVOL_HASH_TABLE +#define EVOL_HASH_TABLE + +#include "common/hercules.h" +#include "common/db.h" + +#define HT_MAX_KEY_LEN 32 + +struct htreg_interface +{ + int64 last_id; + int64 last_iterator_id; + struct DBMap *htables; + struct DBMap *iterators; + void (*init) (void); + void (*final) (void); + int64 (*new_hashtable) (void); + bool (*destroy_hashtable) (int64 id); + bool (*hashtable_exists) (int64 id); + int64 (*hashtable_size) (int64 id); + bool (*clear_hashtable) (int64 id); + const struct DBData* (*hashtable_getvalue) (int64 id, const char *key, + const struct DBData *defval); + bool (*hashtable_setvalue) (int64 id, const char *key, + const struct DBData value); + + int64 (*create_iterator) (int64 id); + bool (*destroy_iterator) (int64 id); + bool (*iterator_check) (int64 id); + bool (*iterator_exists) (int64 id); + const char* (*iterator_nextkey) (int64 id); +}; + +void htreg_defaults(void); +void htreg_init(void); +void htreg_final(void); + +HPShared struct htreg_interface *htreg; + +#endif // EVOL_HASH_TABLE |