base: Tag API methods and variables in trie.hh

Change-Id: I4492dbb997a3ece5cb2675b45bf37d7512449ab6
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33080
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Hoa Nguyen
2020-08-20 18:25:10 -07:00
parent 20b681b6e0
commit 0fbe6589e7

View File

@@ -44,6 +44,8 @@
*
* @tparam Key Type of the key of the tree nodes. Must be an integral type.
* @tparam Value Type of the values associated to the keys.
*
* @ingroup api_base_utils
*/
template <class Key, class Value>
class Trie
@@ -114,11 +116,20 @@ class Trie
Node head;
public:
/**
* @ingroup api_base_utils
*/
typedef Node *Handle;
/**
* @ingroup api_base_utils
*/
Trie() : head(0, 0, NULL)
{}
/**
* @ingroup api_base_utils
*/
static const unsigned MaxBits = sizeof(Key) * 8;
private:
@@ -192,6 +203,8 @@ class Trie
* @param width How many bits of the key (from msb) should be used.
* @param val A pointer to the value to store in the trie.
* @return A Handle corresponding to this value.
*
* @ingroup api_base_utils
*/
Handle
insert(Key key, unsigned width, Value *val)
@@ -278,6 +291,8 @@ class Trie
* Method which looks up the Value corresponding to a particular key.
* @param key The key to look up.
* @return The first Value matching this key, or NULL if none was found.
*
* @ingroup api_base_utils
*/
Value *
lookup(Key key)
@@ -293,6 +308,8 @@ class Trie
* Method to delete a value from the trie.
* @param node A Handle to remove.
* @return The Value pointer from the removed entry.
*
* @ingroup api_base_utils
*/
Value *
remove(Handle handle)
@@ -337,6 +354,8 @@ class Trie
* Method to lookup a value from the trie and then delete it.
* @param key The key to look up and then remove.
* @return The Value pointer from the removed entry, if any.
*
* @ingroup api_base_utils
*/
Value *
remove(Key key)
@@ -350,6 +369,8 @@ class Trie
/**
* A method which removes all key/value pairs from the trie. This is more
* efficient than trying to remove elements individually.
*
* @ingroup api_base_utils
*/
void
clear()