HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy > Class Template Reference

Caches values that are uniquely identified by a key. More...

#include <cache.h>

Collaboration diagram for HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >:
Collaboration graph
[legend]

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)
Elementcapture (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

Detailed Description

template<typename Key, typename Cached, typename Hasher, typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
class HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >

Caches values that are uniquely identified by a key.

Parameters:
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.


Member Typedef Documentation

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
typedef SharedValue<Cached> HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::Element [private]

Definition at line 95 of file cache.h.

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
typedef map_type::iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::iterator

Definition at line 108 of file cache.h.

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
typedef HashTable<Key, Element, Hasher, KeyEqual> HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::map_type [private]

Definition at line 96 of file cache.h.

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
typedef map_type::value_type HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::value_type

Definition at line 109 of file cache.h.


Constructor & Destructor Documentation

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::HashedCache ( const CreationPolicy &  creation = CreationPolicy()  )  [inline, explicit]

Definition at line 101 of file cache.h.

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::~HashedCache (  )  [inline]

Member Function Documentation

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::begin (  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
Element& HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::capture ( const Key &  key  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::capture ( iterator  i  )  [inline]

Definition at line 126 of file cache.h.

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::clear (  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
bool HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::empty (  )  const [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::end (  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
iterator HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::find ( const Key &  key  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release ( const Key &  key  )  [inline]
template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
void HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::release ( iterator  i  )  [inline]

Field Documentation

template<typename Key , typename Cached , typename Hasher , typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key>>
map_type HashedCache< Key, Cached, Hasher, KeyEqual, CreationPolicy >::m_map [private]

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2