acl  3.5.3.0
acl_binhash.h 文件参考
#include "acl_define.h"
#include "acl_hash.h"
#include "acl_slice.h"
#include "acl_iterator.h"
+ acl_binhash.h 的引用(Include)关系图:
+ 此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  ACL_BINHASH
 
struct  ACL_BINHASH_INFO
 
struct  ACL_BINHASH_ITER
 

宏定义

#define ACL_BINHASH_FLAG_KEY_REUSE   (1 << 0)
 
#define ACL_BINHASH_FLAG_SLICE_RTGC_OFF   (1 << 1)
 
#define ACL_BINHASH_FLAG_SLICE1   (1 << 2)
 
#define ACL_BINHASH_FLAG_SLICE2   (1 << 3)
 
#define ACL_BINHASH_FLAG_SLICE3   (1 << 4)
 
#define ACL_BINHASH_STAT_OK   0
 
#define ACL_BINHASH_STAT_INVAL   1
 
#define ACL_BINHASH_STAT_DUPLEX_KEY   2
 
#define ACL_BINHASH_STAT_NO_KEY   3
 
#define ACL_BINHASH_ITER_KEY(iter)   ((iter).ptr->key.c_key)
 
#define acl_binhash_iter_key   ACL_BINHASH_ITER_KEY
 
#define ACL_BINHASH_ITER_VALUE(iter)   ((iter).ptr->value)
 
#define acl_binhash_iter_value   ACL_BINHASH_ITER_VALUE
 
#define ACL_BINHASH_FOREACH(iter, table_ptr)
 
#define ACL_BINHASH_FOREACH_REVERSE(iter, table_ptr)
 
#define acl_binhash_foreach   ACL_BINHASH_FOREACH
 
#define acl_binhash_foreach_reverse   ACL_BINHASH_FOREACH_REVERSE
 

类型定义

typedef struct ACL_BINHASH ACL_BINHASH
 
typedef struct ACL_BINHASH_INFO ACL_BINHASH_INFO
 
typedef struct ACL_BINHASH_ITER ACL_BINHASH_ITER
 

函数

ACL_API ACL_BINHASHacl_binhash_create (int size, unsigned int flag)
 
ACL_API ACL_BINHASH_INFOacl_binhash_enter (ACL_BINHASH *table, const void *key, int key_len, void *value)
 
ACL_API ACL_BINHASH_INFOacl_binhash_locate (ACL_BINHASH *table, const void *key, int key_len)
 
ACL_API void * acl_binhash_find (ACL_BINHASH *table, const void *key, int key_len)
 
ACL_API int acl_binhash_delete (ACL_BINHASH *table, const void *key, int key_len, void(*free_fn)(void *))
 
ACL_API void acl_binhash_free (ACL_BINHASH *table, void(*free_fn)(void *))
 
ACL_API void acl_binhash_walk (ACL_BINHASH *table, void(*walk_fn)(ACL_BINHASH_INFO *, void *), void *arg)
 
ACL_API ACL_BINHASH_INFO ** acl_binhash_list (ACL_BINHASH *table)
 
ACL_API int acl_binhash_errno (ACL_BINHASH *table)
 
ACL_API int acl_binhash_size (const ACL_BINHASH *table)
 
ACL_API int acl_binhash_used (ACL_BINHASH *table)
 
ACL_API ACL_BINHASH_INFO ** acl_binhash_data (ACL_BINHASH *table)
 
ACL_API const ACL_BINHASH_INFOacl_binhash_iter_head (ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
 
ACL_API const ACL_BINHASH_INFOacl_binhash_iter_next (ACL_BINHASH_ITER *iter)
 
ACL_API const ACL_BINHASH_INFOacl_binhash_iter_tail (ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
 
ACL_API const ACL_BINHASH_INFOacl_binhash_iter_prev (ACL_BINHASH_ITER *iter)
 

宏定义说明

◆ ACL_BINHASH_FLAG_KEY_REUSE

#define ACL_BINHASH_FLAG_KEY_REUSE   (1 << 0)

在文件 acl_binhash.h79 行定义.

◆ ACL_BINHASH_FLAG_SLICE1

#define ACL_BINHASH_FLAG_SLICE1   (1 << 2)

在文件 acl_binhash.h81 行定义.

◆ ACL_BINHASH_FLAG_SLICE2

#define ACL_BINHASH_FLAG_SLICE2   (1 << 3)

在文件 acl_binhash.h82 行定义.

◆ ACL_BINHASH_FLAG_SLICE3

#define ACL_BINHASH_FLAG_SLICE3   (1 << 4)

在文件 acl_binhash.h83 行定义.

◆ ACL_BINHASH_FLAG_SLICE_RTGC_OFF

#define ACL_BINHASH_FLAG_SLICE_RTGC_OFF   (1 << 1)

在文件 acl_binhash.h80 行定义.

◆ ACL_BINHASH_FOREACH

#define ACL_BINHASH_FOREACH (   iter,
  table_ptr 
)
值:
if (table_ptr) \
for((void) acl_binhash_iter_head((table_ptr), &iter); \
(iter).ptr; \
(void) acl_binhash_iter_next(&iter))
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_head(ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_next(ACL_BINHASH_ITER *iter)

在文件 acl_binhash.h224 行定义.

◆ acl_binhash_foreach

#define acl_binhash_foreach   ACL_BINHASH_FOREACH

在文件 acl_binhash.h236 行定义.

◆ ACL_BINHASH_FOREACH_REVERSE

#define ACL_BINHASH_FOREACH_REVERSE (   iter,
  table_ptr 
)
值:
if (table_ptr) \
for((void) acl_binhash_iter_tail((table_ptr), &iter); \
(iter).ptr; \
(void) acl_binhash_iter_prev(&iter))
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_tail(ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_prev(ACL_BINHASH_ITER *iter)

在文件 acl_binhash.h229 行定义.

◆ acl_binhash_foreach_reverse

#define acl_binhash_foreach_reverse   ACL_BINHASH_FOREACH_REVERSE

在文件 acl_binhash.h237 行定义.

◆ ACL_BINHASH_ITER_KEY

#define ACL_BINHASH_ITER_KEY (   iter)    ((iter).ptr->key.c_key)

在文件 acl_binhash.h179 行定义.

◆ acl_binhash_iter_key

#define acl_binhash_iter_key   ACL_BINHASH_ITER_KEY

在文件 acl_binhash.h180 行定义.

◆ ACL_BINHASH_ITER_VALUE

#define ACL_BINHASH_ITER_VALUE (   iter)    ((iter).ptr->value)

在文件 acl_binhash.h182 行定义.

◆ acl_binhash_iter_value

#define acl_binhash_iter_value   ACL_BINHASH_ITER_VALUE

在文件 acl_binhash.h183 行定义.

◆ ACL_BINHASH_STAT_DUPLEX_KEY

#define ACL_BINHASH_STAT_DUPLEX_KEY   2

在文件 acl_binhash.h154 行定义.

◆ ACL_BINHASH_STAT_INVAL

#define ACL_BINHASH_STAT_INVAL   1

在文件 acl_binhash.h153 行定义.

◆ ACL_BINHASH_STAT_NO_KEY

#define ACL_BINHASH_STAT_NO_KEY   3

在文件 acl_binhash.h155 行定义.

◆ ACL_BINHASH_STAT_OK

#define ACL_BINHASH_STAT_OK   0

在文件 acl_binhash.h152 行定义.

类型定义说明

◆ ACL_BINHASH

typedef struct ACL_BINHASH ACL_BINHASH

在文件 acl_binhash.h13 行定义.

◆ ACL_BINHASH_INFO

在文件 acl_binhash.h14 行定义.

◆ ACL_BINHASH_ITER

函数说明

◆ acl_binhash_create()

ACL_API ACL_BINHASH* acl_binhash_create ( int  size,
unsigned int  flag 
)

创建一个哈希表

参数
size{int} 哈希表的初始化大小
flag{unsigned int} 哈希表属性标志位, ACL_BINHASH_FLAG_xxx
返回
{ACL_BINHASH*} 新创建的哈希表指针
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_data()

◆ acl_binhash_delete()

ACL_API int acl_binhash_delete ( ACL_BINHASH table,
const void *  key,
int  key_len,
void(*)(void *)  free_fn 
)

删除某个哈希项

参数
table{ACL_BINHASH*} 哈希表指针
key{const void*} 哈希键
key_len{int} key 的长度
free_fn{void (*)(void*)} 用来释放哈希键值的函数指针,如果为空则不在内部释放键值
返回
{int} 0: ok, -1: error
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_enter()

ACL_API ACL_BINHASH_INFO* acl_binhash_enter ( ACL_BINHASH table,
const void *  key,
int  key_len,
void *  value 
)

向哈希表中添加对象

参数
table{ACL_BINHASH*} 哈希表指针
key{const void*} 哈希键
key_len{int} key 的长度
value{void*} 键值
返回
{ACL_BINHASH_INFO*} 新创建的哈希条目指针
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_errno()

ACL_API int acl_binhash_errno ( ACL_BINHASH table)

获得哈希表操作时的出错号

参数
table{ACL_BINHASH*} 哈希表指针
返回
{int} 错误号
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_find()

ACL_API void* acl_binhash_find ( ACL_BINHASH table,
const void *  key,
int  key_len 
)

查询某个哈希键的键值

参数
table{ACL_BINHASH*} 哈希表指针
key{const void*} 哈希键
key_len{int} key 的长度
返回
{void*} 哈希键值
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_free()

ACL_API void acl_binhash_free ( ACL_BINHASH table,
void(*)(void *)  free_fn 
)

释放哈希表

参数
table{ACL_BINHASH*} 哈希表指针
free_fn{void (*)(void*)} 如果不为空,则用此函数来释放哈希表内的所有键值
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_iter_head()

ACL_API const ACL_BINHASH_INFO* acl_binhash_iter_head ( ACL_BINHASH table,
ACL_BINHASH_ITER iter 
)

◆ acl_binhash_iter_next()

ACL_API const ACL_BINHASH_INFO* acl_binhash_iter_next ( ACL_BINHASH_ITER iter)

◆ acl_binhash_iter_prev()

ACL_API const ACL_BINHASH_INFO* acl_binhash_iter_prev ( ACL_BINHASH_ITER iter)

◆ acl_binhash_iter_tail()

ACL_API const ACL_BINHASH_INFO* acl_binhash_iter_tail ( ACL_BINHASH table,
ACL_BINHASH_ITER iter 
)

◆ acl_binhash_list()

ACL_API ACL_BINHASH_INFO** acl_binhash_list ( ACL_BINHASH table)

列出当前哈希表中的所有元素数组列表

参数
table{ACL_BINHASH*} 哈希表指针
返回
{ACL_BINHASH_INFO*} 哈希表中所有元素组成的ACL_BINHASH_INFO数组, 该数组中的最后一个指针为 NULL
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_locate()

ACL_API ACL_BINHASH_INFO* acl_binhash_locate ( ACL_BINHASH table,
const void *  key,
int  key_len 
)

从哈希表中根据键名取得对应的哈希条目

参数
table{ACL_BINHASH*} 哈希表指针
key{const void*} 哈希键
key_len{int} key 的长度
返回
{ACL_BINHASH_INFO*} 哈希条目指针
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_size()

ACL_API int acl_binhash_size ( const ACL_BINHASH table)

返回哈希表当前的容器空间大小

参数
table哈希表指针
返回
哈希表的容器空间大小
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_used()

ACL_API int acl_binhash_used ( ACL_BINHASH table)

当前哈希表中对象的个数

参数
table{ACL_BINHASH*} 哈希表指针
返回
{int}
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.

◆ acl_binhash_walk()

ACL_API void acl_binhash_walk ( ACL_BINHASH table,
void(*)(ACL_BINHASH_INFO *, void *)  walk_fn,
void *  arg 
)

遍历整个哈希表,并用用户给出的回调函数操作哈希表中的键值

参数
table{ACL_BINHASH*} 哈希表指针
walk_fn{void (*)(ACL_BINHASH_INFO*, void*)} 在遍历哈希表中的每个元素时的回调函数
arg{void*} 用户传递的参数,作为参数在 walk_fn 中传递
示例
F:/download/acl/help/include/acl/stdlib/acl_binhash.h.