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