|typedef IPNet< A >||Key|
|typedef RefTrieNode< A, Payload >||Node|
|stl map interface |
|void||set_root (Node *root)|
|iterator||insert (const Key &net, const Payload &p)|
|insert a key, payload pair, returns an iterator to the newly inserted node. |
|void||erase (const Key &k)|
|delete the node with the given key. |
|void||erase (iterator i)|
|delete the node pointed by the iterator. |
|iterator||find (const Key &k) const|
|given a key, returns an iterator to the entry with the longest matching prefix. |
|iterator||find (const A &a) const|
|given an address, returns an iterator to the entry with the longest matching prefix. |
|iterator||lower_bound (const Key &k) const|
|iterator||begin () const|
|const iterator||end () const|
|iterator||lookup_node (const Key &k) const|
|lookup a subnet, must return exact match if found, end() if not. |
|iterator||search_subtree (const Key &key) const|
|returns an iterator to the subtree rooted at or below the key passed as parameter. |
|iterator||find_less_specific (const Key &key) const|
|find_less_specific asks the question: if I were to add this net to the trie, what would be its parent node? net may or may not already be in the trie. |
|void||find_bounds (const A &a, A &lo, A &hi) const|
|return the lower and higher address in the range that contains a and would map to the same route. |
|int||route_count () const|
|void||print () const|
|string||str () const|
|RefTrie's nodes are reference counted, so it's possible to delete all the nodes in the trie, and for the actually routes to remain around until their reference counts go to zero because iterators still point at a node. |
The RefTrie itself.
The trie support insertion and deletion of Key,Payload pairs, and lookup by Key (which can be an address or a subnet).
Additional methods are supported to provide access via iterators.
|iterator RefTrie< A, Payload >::find_less_specific||(||const Key &||key||)|| const
|iterator RefTrie< A, Payload >::insert||(||const Key &||net,|
|const Payload &||p|
RefTrie's nodes are reference counted, so it's possible to delete all the nodes in the trie, and for the actually routes to remain around until their reference counts go to zero because iterators still point at a node.
If you then delete the trie itself, the nodes will be deleted but the iterator will be invalidated. Instead delete_self() should be called, which sets _deleted, and only finally deletes the trie when all the nodes themselves have gone away.