Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Implementation of a HashMap for owned objects, i.e. anything created with new(). More...
#include <ObjectMap.h>
Classes | |
struct | Entry |
An entry in the ObjectMap. More... | |
class | Value |
Class to provide safe access to mapped value. More... | |
Public Member Functions | |
unsigned | count () const |
Get the number of entries in this map. More... | |
const K & | keyAt (unsigned idx) const |
K & | keyAt (unsigned idx) |
const V * | valueAt (unsigned idx) const |
Value | valueAt (unsigned idx) |
const V * | operator[] (const K &key) const |
Get value for given key, if it exists. More... | |
Value | operator[] (const K &key) |
Access map entry by reference. More... | |
Value | get (const K &key) |
Get map entry value. More... | |
void | set (const K &key, V *value) |
Set a key value. More... | |
V * | find (const K &key) const |
Find the value for a given key, if it exists. More... | |
int | indexOf (const K &key) const |
Get the index of a key. More... | |
bool | contains (const K &key) const |
Check if a key is contained within this map. More... | |
void | removeAt (unsigned index) |
Remove entry at given index. More... | |
bool | remove (const K &key) |
Remove a key from this map. More... | |
V * | extract (const K &key) |
Get the value for a given key and remove it from the map, without destroying it. More... | |
V * | extractAt (unsigned index) |
Get the value at a given index and remove it from the map, without destroying it. More... | |
void | clear () |
Clear the map of all entries. More... | |
Protected Attributes | |
Vector< Entry > | entries |
Implementation of a HashMap for owned objects, i.e. anything created with new().
Example:
|
inline |
Clear the map of all entries.
|
inline |
Check if a key is contained within this map.
key | the key to check |
bool | true if key exists |
|
inline |
Get the number of entries in this map.
int | Entry count |
|
inline |
Get the value for a given key and remove it from the map, without destroying it.
key |
V* |
|
inline |
Get the value at a given index and remove it from the map, without destroying it.
index |
V* |
|
inline |
Find the value for a given key, if it exists.
key |
V* | Points to the object if it exists, otherwise nullptr |
operator[]
or valueAt()
|
inline |
Get the index of a key.
key |
int | The index of the key, or -1 if key does not exist |
|
inline |
Get value for given key, if it exists.
key |
const | V* Will be null if not found in the map |
delete
on the returned value Access map entry by reference.
key |
Value | Guarded access to mapped value corresponding to given key |
valueAt()
|
inline |
Remove a key from this map.
key | The key identifying the entry to remove |
bool | true if the value was found and removed |
|
inline |
Remove entry at given index.
index | location to remove from this map |
|
inline |
Set a key value.
key | |
value |