Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Hash_Cache_Map_Manager 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:

Inheritance graph
[legend]
Collaboration diagram for ACE_Hash_Cache_Map_Manager:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_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 Methods

 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. More...

 ~ACE_Hash_Cache_Map_Manager (void)
 Close down a <Cache_Map_Manager> and release dynamically allocated resources. More...

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. More...

int find (const KEY &key)
 Is <key> in the cache? More...

int find (const KEY &key, CACHE_ENTRY *&entry)
 Obtain the entry when the find succeeds. More...

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. More...

int unbind (const KEY &key, VALUE &value)
 Remove <key> from the cache, and return the <value> associated with <key>. More...

int unbind (CACHE_ENTRY *entry)
 Remove entry from map. More...


Protected Types

typedef ACMM< KEY, VALUE,
ACE_Hash_Map_Manager_Ex<
KEY, ACE_Pair< VALUE, ATTRIBUTES >,
HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >,
ACE_Hash_Map_Iterator_Ex<
KEY, ACE_Pair< VALUE, ATTRIBUTES >,
HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >,
ACE_Hash_Map_Reverse_Iterator_Ex<
KEY, ACE_Pair< VALUE, ATTRIBUTES >,
HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex >,
CACHING_STRATEGY, ATTRIBUTES > 
ACE_HCMM_BASE
 Base class. More...


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 isnt efficient. Locking has to be provided by the application.

Definition at line 70 of file Hash_Cache_Map_Manager_T.h.


Member Typedef Documentation

template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACMM<KEY, VALUE, ACE_Hash_Map_Manager_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, ACE_Hash_Map_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, ACE_Hash_Map_Reverse_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, CACHING_STRATEGY, ATTRIBUTES> ACE_Hash_Cache_Map_Manager::ACE_HCMM_BASE [protected]
 

Base class.

Definition at line 199 of file Hash_Cache_Map_Manager_T.h.

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::CACHE_ENTRY
 

Definition at line 81 of file Hash_Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Pair<VALUE, ATTRIBUTES> ACE_Hash_Cache_Map_Manager::CACHE_VALUE
 

The actual value mapped to the key in the map. The <attributes> are used by the strategy and is transparent to the user of this class.

Definition at line 79 of file Hash_Cache_Map_Manager_T.h.

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::HASH_MAP
 

Definition at line 80 of file Hash_Cache_Map_Manager_T.h.

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

Definition at line 82 of file Hash_Cache_Map_Manager_T.h.

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

Definition at line 83 of file Hash_Cache_Map_Manager_T.h.


Constructor & Destructor Documentation

template<T_1 >
ACE_Hash_Cache_Map_Manager<>::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.

Definition at line 25 of file Hash_Cache_Map_Manager_T.cpp.

00028   : ACE_HCMM_BASE (caching_s,
00029                    size,
00030                    alloc)
00031 {
00032 }

template<T_1 >
ACE_Hash_Cache_Map_Manager<>::~ACE_Hash_Cache_Map_Manager void   
 

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

Definition at line 35 of file Hash_Cache_Map_Manager_T.cpp.

00036 {
00037 }


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,
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 >::bind const KEY &    key,
const VALUE &    value
 

Associate <key> with <value>. If <key> is already in the MAP then the ENTRY is not changed. Returns 0 if a new entry is bound successfully, returns 1 if an attempt is made to bind an existing entry, and returns -1 if failures occur.

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 >::find const KEY &    key
 

Is <key> in the cache?

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
 

Loopkup entry<key,value> in the cache.

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 >::rebind const KEY &    key,
const VALUE &    value,
KEY &    old_key,
VALUE &    old_value
 

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.

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
 

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.

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
 

Reassociate the <key> with <value>. If the <key> already exists in the cache then returns 1, on a new bind returns 0 and returns -1 in case of any failures.

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 >::trybind const KEY &    key,
VALUE &    value
 

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.

template<T_1 >
int ACE_Hash_Cache_Map_Manager<>::unbind CACHE_ENTRY   entry
 

Remove entry from map.

Definition at line 209 of file Hash_Cache_Map_Manager_T.cpp.

References ACE_Hash_Map_Entry::int_id_.

00210 {
00211   // Remove the entry from the cache.
00212   int unbind_result = this->map_.unbind (entry);
00213 
00214   if (unbind_result != -1)
00215     {
00216 
00217       int result = this->caching_strategy_.notify_unbind (unbind_result,
00218                                                           entry->int_id_.second ());
00219 
00220       if (result == -1)
00221         unbind_result = -1;
00222 
00223     }
00224 
00225   return unbind_result;
00226 }

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
 

Remove <key> from the cache, and return the <value> associated with <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 >::unbind const KEY &    key
 

Remove <key> from the cache.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:48:27 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002