Caches values that are uniquely identified by a key. More...
#include <cache.h>
Public Types | |
typedef map_type::iterator | iterator |
typedef map_type::value_type | value_type |
Public Member Functions | |
HashedCache (const CreationPolicy &creation=CreationPolicy()) | |
~HashedCache () | |
iterator | begin () |
iterator | end () |
bool | empty () const |
iterator | find (const Key &key) |
void | capture (iterator i) |
void | release (iterator i) |
Element & | capture (const Key &key) |
void | release (const Key &key) |
void | clear () |
Private Types | |
typedef SharedValue< Cached > | Element |
typedef HashTable< Key, Element, Hasher, KeyEqual > | map_type |
Private Attributes | |
map_type | m_map |
Caches values that are uniquely identified by a key.
Key | Uniquely identifies each element. | |
Cached | The type to be cached. Must define a constructor that accepts Key . | |
CreationPolicy | Must define 'Cached* construct(const Key&)' and 'void destroy(Cached*)'. The lifetime of the Key passed to 'construct' is guaranteed to be longer than the subsequent matched call to 'destroy'. |
Definition at line 94 of file cache.h.
typedef SharedValue<Cached> HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::Element [private] |
typedef map_type::iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::iterator |
typedef map_type::value_type HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::value_type |
HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::HashedCache | ( | const CreationPolicy & | creation = CreationPolicy() |
) | [inline, explicit] |
HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::~HashedCache | ( | ) | [inline] |
Definition at line 104 of file cache.h.
References HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::empty().
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::begin | ( | ) | [inline] |
Definition at line 111 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::begin(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
Element& HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::capture | ( | const Key & | key | ) | [inline] |
Definition at line 136 of file cache.h.
References i, HashTable< Key, Value, Hasher, KeyEqual >::insert(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::capture | ( | iterator | i | ) | [inline] |
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::clear | ( | ) | [inline] |
Definition at line 149 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::clear(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
bool HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::empty | ( | ) | const [inline] |
Definition at line 118 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::empty(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
Referenced by HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::~HashedCache().
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::end | ( | ) | [inline] |
Definition at line 114 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::end(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::find | ( | const Key & | key | ) | [inline] |
Definition at line 122 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::find(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release | ( | const Key & | key | ) | [inline] |
Definition at line 143 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::end(), HashTable< Key, Value, Hasher, KeyEqual >::find(), i, HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map, and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release().
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release | ( | iterator | i | ) | [inline] |
Definition at line 129 of file cache.h.
References HashTable< Key, Value, Hasher, KeyEqual >::erase(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map.
Referenced by HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release().
map_type HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map [private] |
Definition at line 98 of file cache.h.
Referenced by HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::begin(), HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::capture(), HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::clear(), HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::empty(), HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::end(), HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::find(), and HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release().