1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef HDF_MAP_H 10 #define HDF_MAP_H 11 12 #include "hdf_base.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif /* __cplusplus */ 17 18 struct MapNode; 19 20 typedef struct { 21 struct MapNode **nodes; /**< Map node bucket */ 22 uint32_t nodeSize; /**< Map node count */ 23 uint32_t bucketSize; /**< Map node bucket size */ 24 } Map; 25 26 void MapInit(Map *map); 27 28 void MapDelete(Map *map); 29 30 int32_t MapSet(Map *map, const char *key, const void *value, uint32_t valueSize); 31 32 void *MapGet(const Map *map, const char *key); 33 34 int32_t MapErase(Map *map, const char *key); 35 36 #ifdef __cplusplus 37 } 38 #endif /* __cplusplus */ 39 40 #endif /* HDF_MAP_H */ 41