Public Member Functions | |
| void | clear () |
| Clears all set objects in the trie. | |
| bool | remove (const char *key) |
| Removes a key from the trie. | |
| K * | retrieve (const char *key) |
| Retrieves a pointer to the object stored at a given key. | |
| bool | replace (const char *key, const K &obj) |
| Inserts or updates the object stored at a key. | |
| bool | insert (const char *key, const K &obj) |
| Inserts an object at a key. | |
| void | bad_iterator (char *buffer, size_t maxlength, void *data, void(*func)(KTrie *, const char *, K &obj, void *data)) |
| Iterates over the trie returning all known values. | |
| KTrie () | |
| ~KTrie () | |
| void | run_destructor (void(*dtor)(K *ptr)) |
| size_t | mem_usage () |
| size_t | size () |
Definition at line 56 of file sm_trie_tpl.h.
| bool KTrie< K >::remove | ( | const char * | key | ) | [inline] |
Removes a key from the trie.
| key | Key to remove. |
Definition at line 75 of file sm_trie_tpl.h.
| K* KTrie< K >::retrieve | ( | const char * | key | ) | [inline] |
Retrieves a pointer to the object stored at a given key.
| key | Key to retrieve. |
Definition at line 97 of file sm_trie_tpl.h.
| bool KTrie< K >::replace | ( | const char * | key, | |
| const K & | obj | |||
| ) | [inline] |
Inserts or updates the object stored at a key.
| key | Key to update or insert. | |
| obj | Object to store at the key. |
Definition at line 114 of file sm_trie_tpl.h.
| bool KTrie< K >::insert | ( | const char * | key, | |
| const K & | obj | |||
| ) | [inline] |
Inserts an object at a key.
| key | Key to insert at. | |
| obj | Object to store at the key. |
Empty strings are a special case, since there are no productions. We could probably rework it to use BASE[0] but this hack is easier.
Definition at line 140 of file sm_trie_tpl.h.
| void KTrie< K >::bad_iterator | ( | char * | buffer, | |
| size_t | maxlength, | |||
| void * | data, | |||
| void(*)(KTrie< K > *, const char *, K &obj, void *data) | func | |||
| ) | [inline] |
Iterates over the trie returning all known values.
Note: This function is for debugging. Do not use it as a production iterator since it's inefficient. Iteration is guaranteed to be sorted ascendingly.
The callback function takes: (KTrie) - Pointer to this Trie (const char *) - String containing key name. (K &) - By-reference object at the key. (data) - User pointer.
| buffer | Buffer to use as a key name cache. | |
| maxlength | Maximum length of the key name buffer. | |
| data | User pointer for passing to the iterator. | |
| func | Iterator callback function. |
Definition at line 670 of file sm_trie_tpl.h.
1.5.1