libdict
Data Structure C Library
Loading...
Searching...
No Matches
hashtable2.h
Go to the documentation of this file.
1/*
2 * libdict -- open-addressing hash-table interface.
3 *
4 * Copyright (c) 2001-2014, Farooq Mela
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef LIBDICT_HASHTABLE2_H__
29#define LIBDICT_HASHTABLE2_H__
30
31#include "dict.h"
32
34
35typedef struct hashtable2 hashtable2;
36
40
43void** hashtable2_search(hashtable2* table, const void* key);
45 hashtable2_remove(hashtable2* table, const void* key);
47size_t hashtable2_traverse(hashtable2* table, dict_visit_func visit, void* user_data);
48size_t hashtable2_count(const hashtable2* table);
49size_t hashtable2_size(const hashtable2* table);
52bool hashtable2_resize(hashtable2* table, unsigned size);
53
55
59
64bool hashtable2_itor_nextn(hashtable2_itor* itor, size_t count);
65bool hashtable2_itor_prevn(hashtable2_itor* itor, size_t count);
68bool hashtable2_itor_search(hashtable2_itor* itor, const void* key);
69const void* hashtable2_itor_key(const hashtable2_itor* itor);
72
74
75#endif /* !LIBDICT_HASHTABLE2_H__ */
#define BEGIN_DECL
Definition dict.h:35
int(* dict_compare_func)(const void *, const void *)
Definition dict.h:54
void(* dict_delete_func)(void *, void *)
Definition dict.h:57
unsigned(* dict_hash_func)(const void *)
Definition dict.h:61
#define END_DECL
Definition dict.h:36
bool(* dict_visit_func)(const void *, void *, void *)
Definition dict.h:59
bool hashtable2_verify(const hashtable2 *table)
Definition hashtable2.c:399
hashtable2_itor * hashtable2_itor_new(hashtable2 *table)
Definition hashtable2.c:416
dict_itor * hashtable2_dict_itor_new(hashtable2 *table)
Definition hashtable2.c:427
void ** hashtable2_search(hashtable2 *table, const void *key)
Definition hashtable2.c:203
bool hashtable2_itor_nextn(hashtable2_itor *itor, size_t count)
Definition hashtable2.c:490
size_t hashtable2_free(hashtable2 *table, dict_delete_func delete_func)
Definition hashtable2.c:147
bool hashtable2_itor_valid(const hashtable2_itor *itor)
Definition hashtable2.c:447
bool hashtable2_itor_prev(hashtable2_itor *itor)
Definition hashtable2.c:476
void ** hashtable2_itor_datum(hashtable2_itor *itor)
Definition hashtable2.c:561
bool hashtable2_itor_remove(hashtable2_itor *itor)
Definition hashtable2.c:567
size_t hashtable2_clear(hashtable2 *table, dict_delete_func delete_func)
Definition hashtable2.c:305
dict_insert_result hashtable2_insert(hashtable2 *table, void *key)
Definition hashtable2.c:187
void hashtable2_itor_invalidate(hashtable2_itor *itor)
Definition hashtable2.c:456
hashtable2 * hashtable2_new(dict_compare_func cmp_func, dict_hash_func hash_func, unsigned initial_size)
Definition hashtable2.c:106
size_t hashtable2_count(const hashtable2 *table)
Definition hashtable2.c:337
size_t hashtable2_slots_used(const hashtable2 *table)
Definition hashtable2.c:349
size_t hashtable2_size(const hashtable2 *table)
Definition hashtable2.c:343
void hashtable2_itor_free(hashtable2_itor *itor)
Definition hashtable2.c:441
bool hashtable2_itor_prevn(hashtable2_itor *itor, size_t count)
Definition hashtable2.c:499
bool hashtable2_itor_first(hashtable2_itor *itor)
Definition hashtable2.c:508
const void * hashtable2_itor_key(const hashtable2_itor *itor)
Definition hashtable2.c:555
bool hashtable2_resize(hashtable2 *table, unsigned size)
Definition hashtable2.c:355
bool hashtable2_itor_next(hashtable2_itor *itor)
Definition hashtable2.c:462
dict_remove_result hashtable2_remove(hashtable2 *table, const void *key)
Definition hashtable2.c:282
size_t hashtable2_traverse(hashtable2 *table, dict_visit_func visit, void *user_data)
Definition hashtable2.c:323
bool hashtable2_itor_search(hashtable2_itor *itor, const void *key)
Definition hashtable2.c:534
bool hashtable2_itor_last(hashtable2_itor *itor)
Definition hashtable2.c:521
dict * hashtable2_dict_new(dict_compare_func cmp_func, dict_hash_func hash_func, unsigned initial_size)
Definition hashtable2.c:129
Definition dict.h:151
hashtable2 * table
Definition hashtable2.c:62
unsigned size
Definition hashtable2.c:58
dict_compare_func cmp_func
Definition hashtable2.c:55
hash_node * table
Definition hashtable2.c:57
dict_hash_func hash_func
Definition hashtable2.c:56