diff options
author | gumi <git@gumi.ca> | 2018-03-26 17:11:34 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-03-26 17:11:34 -0400 |
commit | 3a56da3c09845676534f460f75c8adb6c65fbb79 (patch) | |
tree | b37c703cc7dc07725235a5d916db5d83b65e8ecf /src/emap/hashtable.c | |
parent | c3262df069c597bd3c56e167cadc077c077d0096 (diff) | |
download | evol-hercules-s20180406.tar.gz evol-hercules-s20180406.tar.bz2 evol-hercules-s20180406.tar.xz evol-hercules-s20180406.zip |
add missing hashtable iterator buildinss20180406
Diffstat (limited to 'src/emap/hashtable.c')
-rw-r--r-- | src/emap/hashtable.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/emap/hashtable.c b/src/emap/hashtable.c index 6645a0d..1fead60 100644 --- a/src/emap/hashtable.c +++ b/src/emap/hashtable.c @@ -134,6 +134,32 @@ bool htreg_iterator_exists(int64 id) return i64db_exists(htreg->iterators, id); } +const char* htreg_iterator_firstkey(int64 id) +{ + struct DBIterator *it = i64db_get(htreg->iterators, id); + if (it) + { + union DBKey key; + it->first(it, &key); + if (dbi_exists(it)) + return key.str; + } + return NULL; +} + +const char* htreg_iterator_lastkey(int64 id) +{ + struct DBIterator *it = i64db_get(htreg->iterators, id); + if (it) + { + union DBKey key; + it->last(it, &key); + if (dbi_exists(it)) + return key.str; + } + return NULL; +} + const char* htreg_iterator_nextkey(int64 id) { struct DBIterator *it = i64db_get(htreg->iterators, id); @@ -147,6 +173,19 @@ const char* htreg_iterator_nextkey(int64 id) return NULL; } +const char* htreg_iterator_prevkey(int64 id) +{ + struct DBIterator *it = i64db_get(htreg->iterators, id); + if (it) + { + union DBKey key; + it->prev(it, &key); + if (dbi_exists(it)) + return key.str; + } + return NULL; +} + /** * Initializer. */ @@ -212,5 +251,8 @@ void htreg_defaults(void) htreg->destroy_iterator = htreg_destroy_iterator; htreg->iterator_check = htreg_iterator_check; htreg->iterator_exists = htreg_iterator_exists; + htreg->iterator_firstkey = htreg_iterator_firstkey; + htreg->iterator_lastkey = htreg_iterator_lastkey; htreg->iterator_nextkey = htreg_iterator_nextkey; + htreg->iterator_prevkey = htreg_iterator_prevkey; } |