![]() |
Public API Reference |
![]() |
Hash type that allows (certain) changes of key objects. More...
#include <csutil/weakkeyedhash.h>
Classes | |
class | GlobalIterator |
An iterator class for WeakKeyedHash. More... | |
Public Member Functions | |
const T & | Get (const K &key, const T &fallback) |
Get the first element matching the given key, or fallback if there is none. | |
GlobalIterator | GetIterator () |
Return an iterator for the hash, to iterate over all elements. | |
T & | Put (const K &key, const T &value) |
Add an element to the hash table. |
Hash type that allows (certain) changes of key objects.
This hash type works with keys that may be 'invalidated' as a side effect of some other operation - prime example is csWeakRef<> which gets cleared if the referenced object is destroyed. However, apart from invalidation, key objects may not change their values.
The validity of a key is tested by evaluating it to a bool
. Invalid keys should evaluate to false
(conversely, valid keys should evaluate to true
).
Invalid keys, and values associated with them, are occasionally cleaned out as a part of normal operation (element retrieval, element insertion ...), hence it is likely to occur that the value associated with a key that got invalidated will stay allocated for an unknown amount of time.
Definition at line 51 of file weakkeyedhash.h.
const T& CS::Container::WeakKeyedHash< T, K, ArrayMemoryAlloc, ArrayElementHandler >::Get | ( | const K & | key, |
const T & | fallback | ||
) | [inline] |
Get the first element matching the given key, or fallback if there is none.
Definition at line 61 of file weakkeyedhash.h.
GlobalIterator CS::Container::WeakKeyedHash< T, K, ArrayMemoryAlloc, ArrayElementHandler >::GetIterator | ( | ) | [inline] |
Return an iterator for the hash, to iterate over all elements.
Reimplemented from csHash< T, K, ArrayMemoryAlloc, ArrayElementHandler >.
Definition at line 242 of file weakkeyedhash.h.
T& CS::Container::WeakKeyedHash< T, K, ArrayMemoryAlloc, ArrayElementHandler >::Put | ( | const K & | key, |
const T & | value | ||
) | [inline] |
Add an element to the hash table.
Reimplemented from csHash< T, K, ArrayMemoryAlloc, ArrayElementHandler >.
Definition at line 93 of file weakkeyedhash.h.