1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LNN_MAP_STRUCT_H 17 #define LNN_MAP_STRUCT_H 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif /* __cplusplus */ 25 26 /** 27 * LNN map node struct 28 */ 29 typedef struct tagMapNode { 30 uint32_t hash; 31 uint32_t valueSize; 32 void *key; 33 void *value; 34 struct tagMapNode *next; 35 } MapNode; 36 37 /** 38 * LNN map struct define. 39 */ 40 typedef struct { 41 MapNode **nodes; /* Map node bucket */ 42 uint32_t nodeSize; /* Map node count */ 43 uint32_t bucketSize; /* Map node bucket size */ 44 } Map; 45 46 /** 47 * LNN map node struct 48 */ 49 typedef struct { 50 MapNode *node; /* Map node */ 51 uint32_t nodeNum; /* Map node */ 52 uint32_t bucketNum; /* Map node */ 53 Map *map; 54 } MapIterator; 55 56 #ifdef __cplusplus 57 } 58 #endif /* __cplusplus */ 59 60 #endif /* LNN_MAP_STRUCT_H */