|
ORIGINAL
|
Abstract base class for key-value mapping containers. More...
#include <map.h>


Public Member Functions | |
| virtual bool | add (const K_TYPE &k, const V_TYPE &v)=0 |
| Adds a new key-value pair to the map. | |
| virtual bool | remove (const K_TYPE &k)=0 |
| Removes a key-value pair from the map. | |
| virtual bool | containsKey (const K_TYPE &k) const =0 |
| Checks if a key exists in the map. | |
| virtual V_TYPE | get (const K_TYPE &k) const =0 |
| Gets the value associated with a key. | |
| virtual bool | update (const K_TYPE &key, const V_TYPE &value)=0 |
| Updates the value for an existing key. | |
| virtual const V_TYPE & | operator[] (const K_TYPE &k) const =0 |
| Const access to mapped values. | |
| virtual V_TYPE & | operator[] (const K_TYPE &k)=0 |
| Non-const access to mapped values. | |
| ~map () override | |
| Virtual destructor. | |
Protected Member Functions | |
| map (ALLOC alloc=ALLOC{}) | |
| Constructs a map with the specified allocator. | |
Abstract base class for key-value mapping containers.
| K_TYPE | The key type (must support equality comparison and hashing) |
| V_TYPE | The value type to store |
| ALLOC | Allocator type for memory management (default: allocator) |
This abstract class defines the common interface for all map implementations in the framework. Concrete implementations should inherit from this class and provide the actual storage mechanism.
The map guarantees:
Constructs a map with the specified allocator.
| alloc | Allocator to use for memory management |
|
pure virtual |
Adds a new key-value pair to the map.
| k | The key to add |
| v | The value to associate with the key |
|
pure virtual |
Checks if a key exists in the map.
| k | The key to check |
|
pure virtual |
Gets the value associated with a key.
| k | The key to look up |
| noElementError | if the key doesn't exist |
|
pure virtual |
Const access to mapped values.
| k | The key to access |
| noElementError | if the key doesn't exist |
|
pure virtual |
Non-const access to mapped values.
| k | The key to access |
|
pure virtual |
Removes a key-value pair from the map.
| k | The key to remove |
|
pure virtual |
Updates the value for an existing key.
| key | The key to update |
| value | The new value to associate with the key |