Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends

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>

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

List of all members.

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, 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 Member Functions

 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)
CMAP_TYPE & map (void)
 The map managed by the Cache_Map_Manager.
CACHING_STRATEGY & caching_strategy (void)
 The caching strategy used on the cache.

Protected Attributes

CMAP_TYPE 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 Member Functions

void operator= (const ACMM< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &)
 ACMM (const ACMM< KEY, VALUE, CMAP_TYPE, 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<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.

Definition at line 61 of file Cache_Map_Manager_T.h.


Member Typedef Documentation

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Pair<VALUE, ATTRIBUTES> ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::CACHE_VALUE
template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef CACHING_STRATEGY ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::caching_strategy_type

Definition at line 69 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ITERATOR ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::iterator

Definition at line 85 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::ITERATOR

Definition at line 79 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ITERATOR_IMPL ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::ITERATOR_IMPLEMENTATION

Definition at line 71 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef KEY ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::key_type
template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef CMAP_TYPE ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::map_type

Definition at line 68 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef VALUE ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::mapped_type
template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef REVERSE_ITERATOR ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::reverse_iterator

Definition at line 87 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::REVERSE_ITERATOR

Definition at line 81 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
typedef REVERSE_ITERATOR_IMPL ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::REVERSE_ITERATOR_IMPLEMENTATION

Definition at line 72 of file Cache_Map_Manager_T.h.


Constructor & Destructor Documentation

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

Definition at line 31 of file Cache_Map_Manager_T.cpp.

  : caching_strategy_ (caching_s)
{
  if (this->open (size, alloc) == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("%p\n"),
                ACE_TEXT ("ACE_Cache_Map_Manager::ACE_Cache_Map_Manager")));

}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::~ACE_Cache_Map_Manager ( void   )  [virtual]

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

Definition at line 44 of file Cache_Map_Manager_T.cpp.

{
  this->close ();
}


Member Function Documentation

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::ACMM ( const ACMM< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &   )  [private]
template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::begin ( void   )  [inline]

Return forward iterator.

Definition at line 39 of file Cache_Map_Manager_T.inl.

{
  return ITERATOR (this->map_.begin ());
}

template<class KEY, class VALUE, class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::bind ( const KEY &  key,
const VALUE &  value 
)

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.

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 64 of file Cache_Map_Manager_T.cpp.

{
  // Insert an entry which has the <key> and the <cache_value> which
  // is the combination of the <value> and the attributes of the
  // caching strategy.
  CACHE_VALUE cache_value (value,
                           this->caching_strategy_.attributes ());

  int bind_result = this->map_.bind (key,
                                     cache_value);

  if (bind_result != -1)
    {

      int result = this->caching_strategy_.notify_bind (bind_result,
                                                        cache_value.second ());

      if (result == -1)
        {

          this->map_.unbind (key);

          // Unless the notification goes thru the bind operation is
          // not complete.
          bind_result = -1;

        }

    }

  return bind_result;
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
CACHING_STRATEGY & ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::caching_strategy ( void   )  [inline]

The caching strategy used on the cache.

Definition at line 33 of file Cache_Map_Manager_T.inl.

{
  return this->caching_strategy_;
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::close ( void   ) 

Close down a cache and release dynamically allocated resources.

Definition at line 58 of file Cache_Map_Manager_T.cpp.

{
  return this->map_.close ();
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
size_t ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::current_size ( void   )  const [inline]

Return the current size of the cache.

Definition at line 15 of file Cache_Map_Manager_T.inl.

{
  return this->map_.current_size ();
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
void ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::dump ( void   )  const

Dumps the state of the object.

Definition at line 401 of file Cache_Map_Manager_T.cpp.

{
#if defined (ACE_HAS_DUMP)
  this->map_.dump ();

  this->caching_strategy_.dump ();
#endif /* ACE_HAS_DUMP */
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::end ( void   )  [inline]

Definition at line 45 of file Cache_Map_Manager_T.inl.

{
  return ITERATOR (this->map_.end ());
}

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 275 of file Cache_Map_Manager_T.cpp.

{
  // Lookup the key and populate the <value>.
  CACHE_VALUE cache_value;

  int find_result = this->map_.find (key,
                                     cache_value);

  if (find_result != -1)
    {

      int result = this->caching_strategy_.notify_find (find_result,
                                                        cache_value.second ());

      // Unless the find and notification operations go thru, this
      // method is not successful.
      if (result == -1)
        find_result = -1;
      else
        {

          // Since the <cache_value> has now changed after the
          // notification, we need to bind to the map again.
          int rebind_result = this->map_.rebind (key,
                                                 cache_value);
          if (rebind_result == -1)
            find_result = -1;
          else
            value = cache_value.first ();

        }

    }

  return find_result;
}

template<class KEY, class VALUE, class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::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 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).

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 314 of file Cache_Map_Manager_T.cpp.

{
  // Lookup the key and populate the <value>.
  CACHE_VALUE cache_value;

  int find_result = this->map_.find (key,
                                     cache_value);

  if (find_result != -1)
    {

      int result = this->caching_strategy_.notify_find (find_result,
                                                        cache_value.second ());

      // Unless the find and notification operations go thru, this
      // method is not successful.
      if (result == -1)
        find_result = -1;
      else
        {

          // Since the <cache_value> has now changed after the
          // notification, we need to bind to the map again.
          int rebind_result = this->map_.rebind (key,
                                                 cache_value);

          if (rebind_result == -1)
            find_result = -1;

        }

    }

  return find_result;
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
CMAP_TYPE & ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::map ( void   )  [inline]

The map managed by the Cache_Map_Manager.

Definition at line 27 of file Cache_Map_Manager_T.inl.

{
  return this->map_;
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::open ( size_t  length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator alloc = 0 
)

Initialize a cache with size length.

Definition at line 50 of file Cache_Map_Manager_T.cpp.

{
  return this->map_.open (length,
                          alloc);
}

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
void ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::operator= ( const ACMM< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > &   )  [private]
template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::purge ( void   )  [inline]

Remove entries from the cache depending upon the strategy.

Definition at line 8 of file Cache_Map_Manager_T.inl.

{
  return this->caching_strategy ().caching_utility ().clear_cache (this->map_,
                                                                   this->caching_strategy ().purge_percent ());
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::rbegin ( void   )  [inline]

Return reverse iterator.

Definition at line 51 of file Cache_Map_Manager_T.inl.

{
  return REVERSE_ITERATOR (this->map_.rbegin ());
}

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 184 of file Cache_Map_Manager_T.cpp.

{
  CACHE_VALUE cache_value (value,
                           this->caching_strategy_.attributes ());

  CACHE_VALUE old_cache_value (old_value,
                               this->caching_strategy_.attributes ());

  int rebind_result = this->map_.rebind (key,
                                         cache_value,
                                         old_key,
                                         old_cache_value);

  if (rebind_result != -1)
    {

      int result = this->caching_strategy_.notify_rebind (rebind_result,
                                                          cache_value.second ());

      if (result == -1)
        {

          // Make sure the unbind operation is done only when the
          // notification fails after a bind which is denoted by
          // rebind_result = 0
          if (rebind_result == 0)
            this->map_.unbind (key);

          // Unless the notification goes thru the rebind operation is
          // not complete.
          rebind_result = -1;

        }
      else
        {

          old_value = old_cache_value.first ();

        }

    }

  return rebind_result;
}

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 100 of file Cache_Map_Manager_T.cpp.

{
  CACHE_VALUE cache_value (value,
                           this->caching_strategy_.attributes ());

  int rebind_result = this->map_.rebind (key,
                                         cache_value);

  if (rebind_result != -1)
    {

      int result = this->caching_strategy_.notify_rebind (rebind_result,
                                                          cache_value.second ());

      if (result == -1)
        {

          // Make sure the unbind operation is done only when the
          // notification fails after a bind which is denoted by
          // rebind_result = 0
          if (rebind_result == 0)
            this->map_.unbind (key);

          // Unless the notification goes thru the rebind operation is
          // not complete.
          rebind_result = -1;

        }

    }

  return rebind_result;
}

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 137 of file Cache_Map_Manager_T.cpp.

{
  CACHE_VALUE cache_value (value,
                           this->caching_strategy_.attributes ());

  CACHE_VALUE old_cache_value (old_value,
                               this->caching_strategy_.attributes ());

  int rebind_result = this->map_.rebind (key,
                                         cache_value,
                                         old_cache_value);

  if (rebind_result != -1)
    {

      int result = this->caching_strategy_.notify_rebind (rebind_result,
                                                          cache_value.second ());

      if (result == -1)
        {

          // Make sure the unbind operation is done only when the
          // notification fails after a bind which is denoted by
          // rebind_result = 0
          if (rebind_result == 0)
            this->map_.unbind (key);

          // Unless the notification goes thru the rebind operation is
          // not complete.
          rebind_result = -1;

        }
      else
        {

          old_value = old_cache_value.first ();

        }

    }

  return rebind_result;
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES > ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::rend ( void   )  [inline]

Definition at line 56 of file Cache_Map_Manager_T.inl.

{
  return REVERSE_ITERATOR (this->map_.rend ());
}

template<class KEY , class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
size_t ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::total_size ( void   )  const [inline]

Return the total size of the cache.

Definition at line 21 of file Cache_Map_Manager_T.inl.

{
  return this->map_.total_size ();
}

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 233 of file Cache_Map_Manager_T.cpp.

{
  CACHE_VALUE cache_value (value,
                           this->caching_strategy_.attributes ());

  int trybind_result = this->map_.trybind (key,
                                           cache_value);

  if (trybind_result != -1)
    {

      int result = this->caching_strategy_.notify_trybind (trybind_result,
                                                           cache_value.second ());

      if (result == -1)
        {

          // If the entry has got inserted into the map, it is removed
          // due to failure.
          if (trybind_result == 0)
            this->map_.unbind (key);

          trybind_result = -1;

        }
      else
        {

          // If an attempt is made to bind an existing entry the value
          // is overwritten with the value from the map.
          if (trybind_result == 1)
            value = cache_value.first ();

        }

    }

  return trybind_result;
}

template<class KEY, class VALUE , class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::unbind ( const KEY &  key  ) 

Remove key from the cache.

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 352 of file Cache_Map_Manager_T.cpp.

{
  // Remove the entry from the cache.
  CACHE_VALUE cache_value;

  int unbind_result = this->map_.unbind (key,
                                         cache_value);

  if (unbind_result != -1)
    {

      int result = this->caching_strategy_.notify_unbind (unbind_result,
                                                          cache_value.second ());

      if (result == -1)
        unbind_result = -1;

    }

  return unbind_result;
}

template<class KEY, class VALUE, class CMAP_TYPE , class ITERATOR_IMPL , class REVERSE_ITERATOR_IMPL , class CACHING_STRATEGY , class ATTRIBUTES >
int ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::unbind ( const KEY &  key,
VALUE &  value 
)

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

Reimplemented in ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >, and ACE_Hash_Cache_Map_Manager< REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, ACE_Equal_To< REFCOUNTED_HASH_RECYCLABLE_ADDRESS >, CACHING_STRATEGY, ATTRIBUTES >.

Definition at line 375 of file Cache_Map_Manager_T.cpp.

{
  // Remove the entry from the cache.
  CACHE_VALUE cache_value;

  int unbind_result = this->map_.unbind (key,
                                         cache_value);

  if (unbind_result != -1)
    {

      int result = this->caching_strategy_.notify_unbind (unbind_result,
                                                          cache_value.second ());

      if (result == -1)
        unbind_result = -1;
      else
        value = cache_value.first ();

    }

  return unbind_result;
}


Friends And Related Function Documentation

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
friend class ACE_Cache_Map_Iterator< KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES > [friend]

Definition at line 74 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
friend class ACE_Cache_Map_Reverse_Iterator< KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES > [friend]

Definition at line 75 of file Cache_Map_Manager_T.h.


Member Data Documentation

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
CACHING_STRATEGY& ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::caching_strategy_ [protected]

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

Definition at line 228 of file Cache_Map_Manager_T.h.

template<class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
CMAP_TYPE ACE_Cache_Map_Manager< KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES >::map_ [protected]

The underlying map which needs to be cached.

Definition at line 225 of file Cache_Map_Manager_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines