tuya hasmap module
更多...
#include "tuya_hashmap.h"
浏览源代码.
|
| #define | hashmap_data_traversal(in, key, arg_iterator) tuya_hashmap_data_traversal(in, key, arg_iterator) |
| | traverse all data with same key 更多...
|
| |
|
#define | HASHMAP_FOR_EACH_DATA(in, key, data_iter) TUYA_HASHMAP_FOR_EACH_DATA(in, key, data_iter) |
| | traverse all data with same key
|
| |
| #define | hashmap_free(in) tuya_hashmap_free(in) |
| | free the hashmap 更多...
|
| |
| #define | hashmap_get(in, key, arg) tuya_hashmap_get(in, key, arg) |
| | get an element from the hashmap 更多...
|
| |
| #define | hashmap_length(in) tuya_hashmap_length(in) |
| | get current size of the hashmap 更多...
|
| |
| #define | hashmap_new(table_size) tuya_hashmap_new(table_size) |
| | create a new empty hashmap 更多...
|
| |
| #define | hashmap_put(in, key, data) tuya_hashmap_put(in, key , data) |
| | Add an element to the hashmap 更多...
|
| |
| #define | hashmap_remove(in, key, data) tuya_hashmap_remove(in, key, data) |
| | remove an element from the hashmap 更多...
|
| |
|
|
typedef ANY_T | any_t |
| |
|
typedef ANY_T_ITER | any_t_iter |
| |
|
typedef MAP_T | map_t |
| |
tuya hasmap module
- 版本
- 1.0
- 日期
- 2019-10-30
- 版权所有
- Copyright (c) tuya.inc 2019
◆ hashmap_data_traversal
| #define hashmap_data_traversal |
( |
|
in, |
|
|
|
key, |
|
|
|
arg_iterator |
|
) |
| tuya_hashmap_data_traversal(in, key, arg_iterator) |
traverse all data with same key
- 参数
-
| [in] | in | the hashmap |
| [in] | key | the key of element |
| [in,out] | arg_iterator | the traverse iterator |
- 返回
- MAP_OK on success, others on failed, please refer to the define of hashmap error code
- 注解
- if arg_iterator is NULL, fetch the first element, otherwise, fetch the next element
◆ hashmap_free
| #define hashmap_free |
( |
|
in | ) |
tuya_hashmap_free(in) |
free the hashmap
- 参数
-
| [in] | in | the hashmap need to free |
- 警告
- must remove all element first, otherwise, it will cause element leak
◆ hashmap_get
| #define hashmap_get |
( |
|
in, |
|
|
|
key, |
|
|
|
arg |
|
) |
| tuya_hashmap_get(in, key, arg) |
get an element from the hashmap
- 参数
-
| [in] | in | the hashmap |
| [in] | key | the key of the element |
| [out] | arg | the first value that the key matches |
- 返回
- MAP_OK on success, others on failed, please refer to the define of hashmap error code
◆ hashmap_length
| #define hashmap_length |
( |
|
in | ) |
tuya_hashmap_length(in) |
get current size of the hashmap
- 参数
-
- 返回
- the current size
◆ hashmap_new
| #define hashmap_new |
( |
|
table_size | ) |
tuya_hashmap_new(table_size) |
create a new empty hashmap
- 参数
-
| [in] | table_size | the hash table size |
- 返回
- a new empty hashmap
◆ hashmap_put
| #define hashmap_put |
( |
|
in, |
|
|
|
key, |
|
|
|
data |
|
) |
| tuya_hashmap_put(in, key , data) |
Add an element to the hashmap
- 参数
-
| [in] | in | the hashmap |
| [in] | key | the key of hash element |
| [in] | data | the data of hash element |
- 返回
- MAP_OK on success, others on failed, please refer to the define of hashmap error code
- 注解
- For same key, it does not replace it. it is inserted in the head of the list
◆ hashmap_remove
| #define hashmap_remove |
( |
|
in, |
|
|
|
key, |
|
|
|
data |
|
) |
| tuya_hashmap_remove(in, key, data) |
remove an element from the hashmap
- 参数
-
| [in] | in | the hashmap |
| [in] | key | the key of element |
| [in] | data | the data of the element |
- 返回
- MAP_OK on success, others on failed, please refer to the define of hashmap error code
- 注解
- if data is NULL,then delete the first note match key.if data is not null, then delete the node match key and data.