1 /* 2 * 3 * Copyright 2015 Rockchip Electronics Co., LTD. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef __MPP_TRIE_H__ 19 #define __MPP_TRIE_H__ 20 21 #include "rk_type.h" 22 #include "mpp_err.h" 23 24 typedef void* MppTrie; 25 26 /* spatial optimized tire tree */ 27 typedef struct MppAcNode_t { 28 RK_S16 next[16]; 29 /* idx - tire node index in ascending order */ 30 RK_S32 idx; 31 /* id - tire node carried payload data */ 32 RK_S32 id; 33 } MppTrieNode; 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 MPP_RET mpp_trie_init(MppTrie *trie, RK_S32 node_count, RK_S32 info_count); 40 MPP_RET mpp_trie_deinit(MppTrie trie); 41 42 MPP_RET mpp_trie_add_info(MppTrie trie, const char **info); 43 RK_S32 mpp_trie_get_node_count(MppTrie trie); 44 RK_S32 mpp_trie_get_info_count(MppTrie trie); 45 46 MppTrieNode *mpp_trie_get_node(MppTrieNode *root, const char *name); 47 const char **mpp_trie_get_info(MppTrie trie, const char *name); 48 MppTrieNode *mpp_trie_node_root(MppTrie trie); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif /* __MPP_TRIE_H__ */ 55