|
|
| Bucket () |
| Default constructor so new Buckets just construct into nothing. Can likely just be removed. More...
|
|
| Bucket (IndexType len) |
| Basic constructor, creates singly-linked list with provided size. More...
|
|
void | init (IndexType len) |
| If a Bucket instance is created with the default contructor, this is used to initialize and allocate all the member variables. More...
|
|
|
axom_map::Pair< Key, T > | insert_no_update (const Key &key, const T &value) |
| Inserts a given key-value pair into the linked list if an item with given key does not already exist. Fails if list is full or item with given key already exists. More...
|
|
axom_map::Pair< Key, T > | insert_update (const Key &key, const T &value) |
| Inserts a given key-value pair into the linked list if an item with given key does not already exist, and updates the item's current value with the supplied one if item already exists. Fails if list is full. More...
|
|
bool | remove (const Key &key) |
| Removes item with the given key from the linked list, if item exists. Relinks accordingly. More...
|
|
axom_map::Node< Key, T > & | find (const Key &key) |
| Returns pointer to node containing key-value pair matching provided key, if possible. More...
|
|
int | get_capacity () const |
| Returns maximum number of items that can be stored in this Bucket instance. More...
|
|
int | get_size () const |
| Returns current number of items in this Bucket instance. More...
|
|
template<typename Key, typename T>
class axom::experimental::axom_map::Bucket< Key, T >
Bucket is the implementation of a bucket for this Map with chaining. It's a singly-linked list, and supports search, insertion, and removal.
- Template Parameters
-
Key | the type of the keys stored in each Node in the list. \tparapm T the type of the values stored in each Node in the list. |
template<typename Key , typename T >
Inserts a given key-value pair into the linked list if an item with given key does not already exist. Fails if list is full or item with given key already exists.
- Parameters
-
[in] | key | the key of the key-value pair to be inserted. |
[in] | value | the value of the key-value pair to be inserted. |
- Returns
- Returns a Pair object, with the first element being a pointer to the inserted node and the second element being boolean value true if successful. If insertion fails, the bool is set to False, and the node pointed to is the end node if the list was full, or the item occupying the queried slot if an item with the given key already existed.
References axom::experimental::axom_map::Bucket< Key, T >::m_end, axom::experimental::axom_map::Bucket< Key, T >::m_free, axom::experimental::axom_map::Bucket< Key, T >::m_head, axom::experimental::axom_map::Bucket< Key, T >::m_list, and axom::experimental::axom_map::Bucket< Key, T >::m_size.
template<typename Key , typename T >
Inserts a given key-value pair into the linked list if an item with given key does not already exist, and updates the item's current value with the supplied one if item already exists. Fails if list is full.
- Parameters
-
[in] | key | the key of the key-value pair to be inserted. |
[in] | value | the value of the key-value pair to be inserted. |
- Returns
- Returns a Pair object, with the first element being a pointer to the inserted node and the second element being boolean value true if successful. If insertion fails, or assignment was performed, the bool is set to False. If assignment occured, the node pointed to is the item corresponding to the supplied key. Otherwise, if insertion and assignment failed, the node pointed to is the end node.
References axom::experimental::axom_map::Bucket< Key, T >::m_end, axom::experimental::axom_map::Bucket< Key, T >::m_free, axom::experimental::axom_map::Bucket< Key, T >::m_head, axom::experimental::axom_map::Bucket< Key, T >::m_list, and axom::experimental::axom_map::Bucket< Key, T >::m_size.