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

ACE_Cache_Map_Manager<> Class Template Reference

Defines a abstraction that will purge entries from a map. More...

#include <Cache_Map_Manager_T.h>

List of all members.

Public Types

typedef KEY key_type
typedef VALUE mapped_type
typedef MAP map_type
typedef CACHING_STRATEGY caching_strategy_type
typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION
typedef REVERSE_ITERATOR_IMPL 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
typedef ACE_Pair< VALUE, ATTRIBUTES > CACHE_VALUE

Public Methods

 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 bind (const KEY &key, const VALUE &value)
int find (const KEY &key, VALUE &value)
int find (const KEY &key)
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 trybind (const KEY &key, VALUE &value)
int unbind (const KEY &key)
 Remove <key> from the cache.

int unbind (const KEY &key, VALUE &value)
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)
MAP & map (void)
 The map managed by the Cache_Map_Manager.

CACHING_STRATEGY & caching_strategy (void)
 The caching strategy used on the cache.


Protected Attributes

MAP map_
 The underlying map which needs to be cached.

CACHING_STRATEGY & caching_strategy_
 The strategy to be followed for caching entries in the map.


Private Methods

void operator= (const ACMM< KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &)
 ACMM (const ACMM< KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &)

Friends

class ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES >
class ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES >


Detailed Description

template<ACE_T1>
class ACE_Cache_Map_Manager<>

Defines a abstraction that will purge entries from a map.

The <ACE_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. No locking mechanism provided since locking at this level isn't efficient. Locking has to be provided by the application.


Member Typedef Documentation

template<ACE_T1 >
typedef ACE_Pair<VALUE, ATTRIBUTES> ACE_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.

template<ACE_T1 >
typedef CACHING_STRATEGY ACE_Cache_Map_Manager<>::caching_strategy_type
 

template<ACE_T1 >
typedef ITERATOR ACE_Cache_Map_Manager<>::iterator
 

template<ACE_T1 >
typedef ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> ACE_Cache_Map_Manager<>::ITERATOR
 

template<ACE_T1 >
typedef ITERATOR_IMPL ACE_Cache_Map_Manager<>::ITERATOR_IMPLEMENTATION
 

template<ACE_T1 >
typedef KEY ACE_Cache_Map_Manager<>::key_type
 

template<ACE_T1 >
typedef MAP ACE_Cache_Map_Manager<>::map_type
 

template<ACE_T1 >
typedef VALUE ACE_Cache_Map_Manager<>::mapped_type
 

template<ACE_T1 >
typedef REVERSE_ITERATOR ACE_Cache_Map_Manager<>::reverse_iterator
 

template<ACE_T1 >
typedef ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> ACE_Cache_Map_Manager<>::REVERSE_ITERATOR
 

template<ACE_T1 >
typedef REVERSE_ITERATOR_IMPL ACE_Cache_Map_Manager<>::REVERSE_ITERATOR_IMPLEMENTATION
 


Constructor & Destructor Documentation

template<ACE_T1 >
ACE_Cache_Map_Manager<>::ACE_Cache_Map_Manager CACHING_STRATEGY &    caching_strategy,
size_t    size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator   alloc = 0
 

Initialize a <Cache_Map_Manager> with <caching_strategy> and <size> entries.

template<ACE_T1 >
ACE_Cache_Map_Manager<>::~ACE_Cache_Map_Manager void    [virtual]
 

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


Member Function Documentation

template<ACE_T1 >
ACE_Cache_Map_Manager<>::ACMM const ACMM< KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &    [private]
 

template<ACE_T1 >
ACE_INLINE ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager<>::begin void   
 

Return forward iterator.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::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<ACE_T1 >
ACE_INLINE CACHING_STRATEGY & ACE_Cache_Map_Manager<>::caching_strategy void   
 

The caching strategy used on the cache.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::close void   
 

Close down a cache and release dynamically allocated resources.

template<ACE_T1 >
ACE_INLINE size_t ACE_Cache_Map_Manager<>::current_size void    const
 

Return the current size of the cache.

template<ACE_T1 >
void ACE_Cache_Map_Manager<>::dump void    const
 

Dumps the state of the object.

template<ACE_T1 >
ACE_INLINE ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager<>::end void   
 

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::find const KEY &    key
 

Lookup entry<key,value> in the cache. If it is not found, returns -1. If the <key> is located in the MAP object, the CACHING_STRATEGY is notified of it via notify_find (int result, ATTRIBUTES &attribute). If notify_find also returns 0 (success), then this function returns 0 (success).

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::find const KEY &    key,
VALUE &    value
 

Lookup entry<key,value> in the cache. If it is not found, returns -1. If the <key> is located in the MAP object, the CACHING_STRATEGY is notified of it via notify_find (int result, ATTRIBUTES &attribute). If notify_find also returns 0 (success), then this function returns 0 (success) and sets the cached value in <value>.

template<ACE_T1 >
ACE_INLINE MAP & ACE_Cache_Map_Manager<>::map void   
 

The map managed by the Cache_Map_Manager.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::open size_t    length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator   alloc = 0
 

Initialize a cache with size <length>.

template<ACE_T1 >
void ACE_Cache_Map_Manager<>::operator= const ACMM< KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &    [private]
 

template<ACE_T1 >
ACE_INLINE int ACE_Cache_Map_Manager<>::purge void   
 

Remove entries from the cache depending upon the strategy.

template<ACE_T1 >
ACE_INLINE ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager<>::rbegin void   
 

Return reverse iterator.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::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<ACE_T1 >
int ACE_Cache_Map_Manager<>::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<ACE_T1 >
int ACE_Cache_Map_Manager<>::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<ACE_T1 >
ACE_INLINE ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager<>::rend void   
 

template<ACE_T1 >
ACE_INLINE size_t ACE_Cache_Map_Manager<>::total_size void    const
 

Return the total size of the cache.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::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<ACE_T1 >
int ACE_Cache_Map_Manager<>::unbind const KEY &    key,
VALUE &    value
 

Remove <key> from the cache, and return the <value> associated with <key>.

template<ACE_T1 >
int ACE_Cache_Map_Manager<>::unbind const KEY &    key
 

Remove <key> from the cache.


Friends And Related Function Documentation

template<ACE_T1 >
friend class ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES > [friend]
 

template<ACE_T1 >
friend class ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES > [friend]
 


Member Data Documentation

template<ACE_T1 >
CACHING_STRATEGY& ACE_Cache_Map_Manager<>::caching_strategy_ [protected]
 

The strategy to be followed for caching entries in the map.

template<ACE_T1 >
MAP ACE_Cache_Map_Manager<>::map_ [protected]
 

The underlying map which needs to be cached.


The documentation for this class was generated from the following files:
Generated on Fri Apr 2 16:47:25 2004 for ACE by doxygen1.2.18