ACE  6.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Types
ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES > Class Template Reference

Defines a abstraction which will purge entries from a map. The map considered is the ACE_Hash_Map_Manager_Ex. More...

#include <Hash_Cache_Map_Manager_T.h>

Inheritance diagram for ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::pair< VALUE,
ATTRIBUTES > 
CACHE_VALUE
typedef
ACE_Hash_Map_Manager_Ex< KEY,
CACHE_VALUE, HASH_KEY,
COMPARE_KEYS, ACE_Null_Mutex
HASH_MAP
typedef ACE_Hash_Map_Entry
< KEY, CACHE_VALUE
CACHE_ENTRY
typedef KEY key_type
typedef VALUE mapped_type
- Public Types inherited from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >
typedef
ACE_Hash_Map_Manager_Ex< KEY,
std::pair< VALUE, ATTRIBUTES >
, HASH_KEY, COMPARE_KEYS,
ACE_Null_Mutex
map_type
typedef CACHING_STRATEGY caching_strategy_type
typedef
ACE_Hash_Map_Iterator_Ex< KEY,
std::pair< VALUE, ATTRIBUTES >
, HASH_KEY, COMPARE_KEYS,
ACE_Null_Mutex
ITERATOR_IMPLEMENTATION
typedef
ACE_Hash_Map_Reverse_Iterator_Ex
< KEY, std::pair< VALUE,
ATTRIBUTES >, HASH_KEY,
COMPARE_KEYS, ACE_Null_Mutex
REVERSE_ITERATOR_IMPLEMENTATION
typedef ACE_Cache_Map_Iterator
< KEY, VALUE,
ITERATOR_IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES > 
ITERATOR
typedef
ACE_Cache_Map_Reverse_Iterator
< KEY, VALUE,
REVERSE_ITERATOR_IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES > 
REVERSE_ITERATOR
typedef ITERATOR iterator
typedef REVERSE_ITERATOR reverse_iterator

Public Member Functions

 ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s, size_t size=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
 Initialize a <Hash_Cache_Map_Manager> with size entries.
 ~ACE_Hash_Cache_Map_Manager (void)
int bind (const KEY &key, const VALUE &value)
int bind (const KEY &key, const VALUE &value, CACHE_ENTRY *&entry)
int find (const KEY &key, VALUE &value)
 Loopkup entry<key,value> in the cache.
int find (const KEY &key)
 Is key in the cache?
int find (const KEY &key, CACHE_ENTRY *&entry)
 Obtain the entry when the find succeeds.
int rebind (const KEY &key, const VALUE &value)
int rebind (const KEY &key, const VALUE &value, VALUE &old_value)
int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value)
int rebind (const KEY &key, const VALUE &value, CACHE_ENTRY *&entry)
int trybind (const KEY &key, VALUE &value)
int trybind (const KEY &key, VALUE &value, CACHE_ENTRY *&entry)
int unbind (const KEY &key)
 Remove key from the cache.
int unbind (const KEY &key, VALUE &value)
int unbind (CACHE_ENTRY *entry)
 Remove entry from map.
- Public Member Functions inherited from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >
 ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy, size_t size=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
virtual ~ACE_Cache_Map_Manager (void)
int open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
 Initialize a cache with size length.
int close (void)
 Close down a cache and release dynamically allocated resources.
int purge (void)
 Remove entries from the cache depending upon the strategy.
size_t current_size (void) const
 Return the current size of the cache.
size_t total_size (void) const
 Return the total size of the cache.
void dump (void) const
 Dumps the state of the object.
ITERATOR begin (void)
 Return forward iterator.
ITERATOR end (void)
REVERSE_ITERATOR rbegin (void)
 Return reverse iterator.
REVERSE_ITERATOR rend (void)
ACE_Hash_Map_Manager_Ex< KEY,
std::pair< VALUE, ATTRIBUTES >
, HASH_KEY, COMPARE_KEYS,
ACE_Null_Mutex > & 
map (void)
 The map managed by the Cache_Map_Manager.
CACHING_STRATEGY & caching_strategy (void)
 The caching strategy used on the cache.

Protected Types

typedef ACE_Cache_Map_Manager
< KEY, VALUE,
ACE_Hash_Map_Manager_Ex< KEY,
std::pair< VALUE, ATTRIBUTES >
, HASH_KEY, COMPARE_KEYS,
ACE_Null_Mutex >
, ACE_Hash_Map_Iterator_Ex
< KEY, std::pair< VALUE,
ATTRIBUTES >, HASH_KEY,
COMPARE_KEYS, ACE_Null_Mutex >
, ACE_Hash_Map_Reverse_Iterator_Ex
< KEY, std::pair< VALUE,
ATTRIBUTES >, HASH_KEY,
COMPARE_KEYS, ACE_Null_Mutex >
, CACHING_STRATEGY, ATTRIBUTES > 
ACE_HCMM_BASE
 Base class.

Additional Inherited Members

- Protected Attributes inherited from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >
ACE_Hash_Map_Manager_Ex< KEY,
std::pair< VALUE, ATTRIBUTES >
, HASH_KEY, COMPARE_KEYS,
ACE_Null_Mutex
map_
 The underlying map which needs to be cached.
CACHING_STRATEGY & caching_strategy_
 The strategy to be followed for caching entries in the map.

Detailed Description

template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >

Defines a abstraction which will purge entries from a map. The map considered is the ACE_Hash_Map_Manager_Ex.

The Hash_Cache_Map_Manager will manage the map it contains and provide purging on demand from the map. The strategy for caching is decided by the user and provided to the Cache Manager. The Cache Manager acts as a agent and communicates between the Map and the Strategy for purging entries from the map. To tap the optimal methods like find(key,value,entry) present in the ACE_Hash_Map_Manager, Hash_Cache_Map_Manager provides extra functionality on top of the Cache_Map_Manager. No locking mechanism provided since locking at this level isn't efficient. Locking has to be provided by the application.


Member Typedef Documentation

template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Cache_Map_Manager<KEY, VALUE, ACE_Hash_Map_Manager_Ex<KEY, std::pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, ACE_Hash_Map_Iterator_Ex<KEY, std::pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, ACE_Hash_Map_Reverse_Iterator_Ex<KEY, std::pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, CACHING_STRATEGY, ATTRIBUTES> ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::ACE_HCMM_BASE
protected

Base class.

template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Hash_Map_Entry<KEY, CACHE_VALUE> ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::CACHE_ENTRY
template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef std::pair<VALUE, ATTRIBUTES> ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::CACHE_VALUE
template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::HASH_MAP
template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef KEY ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::key_type
template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef VALUE ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::mapped_type

Constructor & Destructor Documentation

template<class KEY , class VALUE , class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY, class ATTRIBUTES >
ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::ACE_Hash_Cache_Map_Manager ( CACHING_STRATEGY &  caching_s,
size_t  size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator alloc = 0 
)

Initialize a <Hash_Cache_Map_Manager> with size entries.

template<class KEY , class VALUE , class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::~ACE_Hash_Cache_Map_Manager ( void  )

Close down a <Cache_Map_Manager> and release dynamically allocated resources.


Member Function Documentation

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::bind ( const KEY &  key,
const VALUE &  value 
)
inline
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::bind ( const KEY &  key,
const VALUE &  value,
CACHE_ENTRY *&  entry 
)

Same as a normal bind, except the cache entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::find ( const KEY &  key,
VALUE &  value 
)
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::find ( const KEY &  key)
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::find ( const KEY &  key,
CACHE_ENTRY *&  entry 
)

Obtain the entry when the find succeeds.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::rebind ( const KEY &  key,
const VALUE &  value 
)
inline
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::rebind ( const KEY &  key,
const VALUE &  value,
VALUE &  old_value 
)
inline

Reassociate key with value, storing the old value into the "out" parameter old_value. The function fails if key is not in the cache for caches that do not allow user specified keys. However, for caches that allow user specified keys, if the key is not in the cache, a new key / value association is created.

Reimplemented from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::rebind ( const KEY &  key,
const VALUE &  value,
KEY &  old_key,
VALUE &  old_value 
)
inline

Reassociate key with value, storing the old key and value into the "out" parameters old_key and old_value. The function fails if key is not in the cache for caches that do not allow user specified keys. However, for caches that allow user specified keys, if the key is not in the cache, a new key / value association is created.

Reimplemented from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::rebind ( const KEY &  key,
const VALUE &  value,
CACHE_ENTRY *&  entry 
)

Same as a normal rebind, except the cache entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::trybind ( const KEY &  key,
VALUE &  value 
)
inline

Associate key with value if and only if key is not in the cache. If key is already in the cache, then the value parameter is overwritten with the existing value in the cache. Returns 0 if a new key / value association is created. Returns 1 if an attempt is made to bind an existing entry. This function fails for maps that do not allow user specified keys.

Reimplemented from ACE_Cache_Map_Manager< KEY, VALUE, ACE_Hash_Map_Manager_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, ACE_Hash_Map_Reverse_Iterator_Ex< KEY, std::pair< VALUE, ATTRIBUTES >, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >, CACHING_STRATEGY, ATTRIBUTES >.

template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::trybind ( const KEY &  key,
VALUE &  value,
CACHE_ENTRY *&  entry 
)

Same as a normal trybind, except the cache entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.

template<class KEY, class VALUE , class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::unbind ( const KEY &  key)
inline
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::unbind ( const KEY &  key,
VALUE &  value 
)
inline
template<class KEY, class VALUE, class HASH_KEY , class COMPARE_KEYS , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::unbind ( CACHE_ENTRY entry)

Remove entry from map.


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