ACE 8.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Friends | List of all members
ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > Class Template Reference

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

#include <Cache_Map_Manager_T.h>

Inheritance diagram for ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >:
Inheritance graph
[legend]

Public Types

typedef KEY key_type
 
typedef VALUE mapped_type
 
typedef CMAP_TYPE 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, ATTRIBUTESITERATOR
 
typedef ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTESREVERSE_ITERATOR
 
typedef ITERATOR iterator
 
typedef REVERSE_ITERATOR reverse_iterator
 
typedef std::pair< VALUE, ATTRIBUTESCACHE_VALUE
 

Public Member Functions

 ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy, size_t size=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=nullptr)
 
virtual ~ACE_Cache_Map_Manager ()
 
int open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=nullptr)
 Initialize a cache with size length.
 
int close ()
 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 ()
 Remove entries from the cache depending upon the strategy.
 
size_t current_size () const
 Return the current size of the cache.
 
size_t total_size () const
 Return the total size of the cache.
 
void dump () const
 Dumps the state of the object.
 
ITERATOR begin ()
 Return forward iterator.
 
ITERATOR end ()
 
REVERSE_ITERATOR rbegin ()
 Return reverse iterator.
 
REVERSE_ITERATOR rend ()
 
CMAP_TYPEmap ()
 The map managed by the Cache_Map_Manager.
 
CACHING_STRATEGYcaching_strategy ()
 The caching strategy used on the cache.
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 

Protected Attributes

CMAP_TYPE map_
 The underlying map which needs to be cached.
 
CACHING_STRATEGYcaching_strategy_
 The strategy to be followed for caching entries in the map.
 

Private Member Functions

void operator= (const ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &)=delete
 
 ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &)=delete
 

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<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >

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

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

◆ caching_strategy_type

◆ ITERATOR

◆ iterator

◆ ITERATOR_IMPLEMENTATION

◆ key_type

◆ map_type

◆ mapped_type

◆ REVERSE_ITERATOR

◆ reverse_iterator

◆ REVERSE_ITERATOR_IMPLEMENTATION

Constructor & Destructor Documentation

◆ ACE_Cache_Map_Manager() [1/2]

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

◆ ~ACE_Cache_Map_Manager()

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

◆ ACE_Cache_Map_Manager() [2/2]

Member Function Documentation

◆ begin()

Return forward iterator.

◆ bind()

Associate key with value. If key is already in the CMAP_TYPE 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.

◆ caching_strategy()

The caching strategy used on the cache.

◆ close()

Close down a cache and release dynamically allocated resources.

◆ current_size()

Return the current size of the cache.

◆ dump()

Dumps the state of the object.

◆ end()

◆ find() [1/2]

Lookup entry<key,value> in the cache. If it is not found, returns -1. If the key is located in the CMAP_TYPE 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).

◆ find() [2/2]

Lookup entry<key,value> in the cache. If it is not found, returns -1. If the key is located in the CMAP_TYPE 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.

◆ map()

The map managed by the Cache_Map_Manager.

◆ open()

Initialize a cache with size length.

◆ operator=()

◆ purge()

Remove entries from the cache depending upon the strategy.

◆ rbegin()

Return reverse iterator.

◆ rebind() [1/3]

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.

◆ rebind() [2/3]

int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, 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.

◆ rebind() [3/3]

int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, 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.

◆ rend()

◆ total_size()

Return the total size of the cache.

◆ trybind()

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.

◆ unbind() [1/2]

Remove key from the cache.

◆ unbind() [2/2]

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

Friends And Related Symbol Documentation

◆ ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES >

◆ ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES >

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ caching_strategy_

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

◆ map_

The underlying map which needs to be cached.


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