83 map.set(key, newValue);
103 return map.remove(key);
113 return map.extract(key);
228 return (index < 0) ? nullptr :
entries[index].value.get();
295 std::unique_ptr<V> value;
297 entries[index].value.swap(value);
300 return value.release();
321 return key == keyToFind;
326 this->value.reset(
value);
long map(long, long, long, long, long)
void size_t const void * key
Definition: blake2s.h:33
Class to provide safe access to mapped value.
Definition: ObjectMap.h:65
V * operator->() const
Definition: ObjectMap.h:92
const K & getKey() const
Definition: ObjectMap.h:71
Value(ObjectMap< K, V > &map, const K &key)
Definition: ObjectMap.h:67
V * getValue() const
Definition: ObjectMap.h:76
V * extract()
Get the value for a given key and remove it from the map, without destroying it.
Definition: ObjectMap.h:111
bool remove()
Remove this value from the map.
Definition: ObjectMap.h:101
Value & operator=(V *newValue)
Definition: ObjectMap.h:81
Implementation of a HashMap for owned objects, i.e. anything created with new().
Definition: ObjectMap.h:49
Value valueAt(unsigned idx)
Definition: ObjectMap.h:167
unsigned count() const
Get the number of entries in this map.
Definition: ObjectMap.h:125
void removeAt(unsigned index)
Remove entry at given index.
Definition: ObjectMap.h:255
V * find(const K &key) const
Find the value for a given key, if it exists.
Definition: ObjectMap.h:225
~ObjectMap()
Definition: ObjectMap.h:55
ObjectMap()
Definition: ObjectMap.h:51
V * extract(const K &key)
Get the value for a given key and remove it from the map, without destroying it.
Definition: ObjectMap.h:281
V * extractAt(unsigned index)
Get the value at a given index and remove it from the map, without destroying it.
Definition: ObjectMap.h:293
void clear()
Clear the map of all entries.
Definition: ObjectMap.h:306
Value get(const K &key)
Get map entry value.
Definition: ObjectMap.h:200
const V * operator[](const K &key) const
Get value for given key, if it exists.
Definition: ObjectMap.h:178
int indexOf(const K &key) const
Get the index of a key.
Definition: ObjectMap.h:236
Vector< Entry > entries
Definition: ObjectMap.h:330
bool remove(const K &key)
Remove a key from this map.
Definition: ObjectMap.h:265
bool contains(const K &key) const
Check if a key is contained within this map.
Definition: ObjectMap.h:246
const K & keyAt(unsigned idx) const
Definition: ObjectMap.h:135
void set(const K &key, V *value)
Set a key value.
Definition: ObjectMap.h:209
const V * valueAt(unsigned idx) const
Definition: ObjectMap.h:156
Value operator[](const K &key)
Access map entry by reference.
Definition: ObjectMap.h:190
K & keyAt(unsigned idx)
Definition: ObjectMap.h:145
Vector class template.
Definition: WVector.h:32
Value
Definition: Components/IFS/src/include/IFS/Error.h:82
An entry in the ObjectMap.
Definition: ObjectMap.h:315
K key
Definition: ObjectMap.h:316
Entry(const K &key, V *value)
Definition: ObjectMap.h:324
std::unique_ptr< V > value
Definition: ObjectMap.h:317
bool operator==(const K &keyToFind) const
Definition: ObjectMap.h:319