117 #ifndef __TOMMYTRIEINP_H
118 #define __TOMMYTRIEINP_H
130 #define TOMMY_TRIE_INPLACE_TREE_MAX 4
135 #define TOMMY_TRIE_INPLACE_TREE_BIT TOMMY_ILOG2(TOMMY_TRIE_INPLACE_TREE_MAX)
140 #define TOMMY_TRIE_INPLACE_BUCKET_BIT ((TOMMY_KEY_BIT % TOMMY_TRIE_INPLACE_TREE_BIT) + 3 * TOMMY_TRIE_INPLACE_TREE_BIT)
146 #define TOMMY_TRIE_INPLACE_BUCKET_MAX (1 << TOMMY_TRIE_INPLACE_BUCKET_BIT)
229 return trie_inplace->
count;
struct tommy_trie_inplace_struct tommy_trie_inplace
Trie container type.
tommy_count_t tommy_trie_inplace_count(tommy_trie_inplace *trie_inplace)
Gets the number of elements.
Definition: tommytrieinp.h:227
tommy_uint32_t tommy_count_t
Generic unsigned integer for counting objects.
Definition: tommytypes.h:67
tommy_uint32_t tommy_key_t
Key type used in indexed data structures to store the key or the hash value.
Definition: tommytypes.h:160
void * tommy_trie_inplace_search(tommy_trie_inplace *trie_inplace, tommy_key_t key)
Searches an element in the trie.
Definition: tommytrieinp.h:207
struct tommy_trie_inplace_node_struct * prev
Circular previous element.
Definition: tommytrieinp.h:154
Trie node.
Definition: tommytrieinp.h:152
#define TOMMY_TRIE_INPLACE_TREE_MAX
Number of branches on each node.
Definition: tommytrieinp.h:130
struct tommy_trie_inplace_node_struct * next
Next element.
Definition: tommytrieinp.h:153
tommy_count_t count
Number of elements.
Definition: tommytrieinp.h:166
void * tommy_trie_inplace_remove_existing(tommy_trie_inplace *trie_inplace, tommy_trie_inplace_node *node)
Removes an element from the trie.
void * data
Pointer to the data.
Definition: tommytrieinp.h:155
void tommy_trie_inplace_init(tommy_trie_inplace *trie_inplace)
Initializes the trie.
void tommy_trie_inplace_insert(tommy_trie_inplace *trie_inplace, tommy_trie_inplace_node *node, void *data, tommy_key_t key)
Inserts an element in the trie.
size_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:50
void * tommy_trie_inplace_remove(tommy_trie_inplace *trie_inplace, tommy_key_t key)
Searches and removes the first element with the specified key.
tommy_trie_inplace_node * bucket[TOMMY_TRIE_INPLACE_BUCKET_MAX]
First tree level.
Definition: tommytrieinp.h:165
tommy_size_t tommy_trie_inplace_memory_usage(tommy_trie_inplace *trie_inplace)
Gets the size of allocated memory.
Trie container type.
Definition: tommytrieinp.h:164
struct tommy_trie_inplace_node_struct tommy_trie_inplace_node
Trie node.
tommy_key_t key
Branches of the node.
Definition: tommytrieinp.h:157
tommy_trie_inplace_node * tommy_trie_inplace_bucket(tommy_trie_inplace *trie_inplace, tommy_key_t key)
Gets the bucket of the specified key.