|
| | Trie () |
| |
| Handle | insert (Key key, unsigned width, Value *val) |
| | Method which inserts a key/value pair into the trie. More...
|
| |
| Value * | lookup (Key key) |
| | Method which looks up the Value corresponding to a particular key. More...
|
| |
| Value * | remove (Handle handle) |
| | Method to delete a value from the trie. More...
|
| |
| Value * | remove (Key key) |
| | Method to lookup a value from the trie and then delete it. More...
|
| |
| void | clear () |
| | A method which removes all key/value pairs from the trie. More...
|
| |
| void | dump (const char *title, std::ostream &os=std::cout) |
| | A debugging method which prints the contents of this trie. More...
|
| |
template<class Key, class Value>
class Trie< Key, Value >
Definition at line 43 of file trie.hh.
template<class Key, class Value>
| Key Trie< Key, Value >::extendMask |
( |
Key |
orig | ) |
|
|
inlineprivate |
A utility method which extends a mask value one more bit towards the lsb.
This is almost just a signed right shift, except that the shifted in bits are technically undefined. This is also slightly complicated by the zero case.
- Parameters
-
| orig | The original mask to extend. |
- Returns
- The extended mask.
Definition at line 146 of file trie.hh.
Referenced by Trie< Addr, uint32_t >::insert().
template<class Key, class Value>
| bool Trie< Key, Value >::goesAfter |
( |
Node ** |
parent, |
|
|
Node * |
kid, |
|
|
Key |
key, |
|
|
Key |
new_mask |
|
) |
| |
|
inlineprivate |
A utility method which checks whether the key being looked up lies beyond the Node being examined.
If so, it returns true and advances the node being examined.
- Parameters
-
| parent | The node we're currently "at", which can be updated. |
| kid | The node we may want to move to. |
| key | The key we're looking for. |
| new_mask | The mask to use when matching against the key. |
- Returns
- Whether the current Node was advanced.
Definition at line 127 of file trie.hh.
Referenced by Trie< Addr, uint32_t >::insert().
template<class Key, class Value>
| Handle Trie< Key, Value >::lookupHandle |
( |
Key |
key | ) |
|
|
inlineprivate |
Method which looks up the Handle corresponding to a particular key.
This is useful if you want to delete the Handle corresponding to a key since the "remove" function takes a Handle as its argument.
- Parameters
-
- Returns
- The first Handle matching this key, or NULL if none was found.
Definition at line 161 of file trie.hh.
Referenced by Trie< Addr, uint32_t >::lookup(), and Trie< Addr, uint32_t >::remove().