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) { 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 <ACE_T1> int ACE_Hash_Cache_Map_Manager<ACE_T2>:: bind (const KEY &key, const VALUE &value, CACHE_ENTRY *&entry) { // Insert a 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, entry); 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> int ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::bind (const KEY &key, const VALUE &value) { // 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 <ACE_T1> int ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, const VALUE &value) { 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 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) { // Insert a 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, entry); 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 <ACE_T1> int ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, VALUE &value, CACHE_ENTRY *&entry) { CACHE_VALUE cache_value (value, this->caching_strategy_.attributes ()); int trybind_result = this->map_.trybind (key, cache_value, entry); 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>::trybind (const KEY &key, VALUE &value) { 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 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) { CACHE_VALUE cache_value (value, this->caching_strategy_.attributes ()); int rebind_result = this->map_.rebind (key, cache_value, entry); 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; }