#include <Hash_Multi_Map_Manager_T.h>
Collaboration diagram for ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >:
Public Types | |
typedef EXT_ID | KEY |
typedef INT_ID | VALUE |
typedef ACE_LOCK | lock_type |
typedef ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > | ENTRY |
typedef ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | ITERATOR |
typedef ACE_Hash_Multi_Map_Const_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | CONST_ITERATOR |
typedef ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | REVERSE_ITERATOR |
typedef ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | iterator |
typedef ACE_Hash_Multi_Map_Const_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | const_iterator |
typedef ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | reverse_iterator |
Public Member Functions | |
ACE_Hash_Multi_Map_Manager (ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0) | |
ACE_Hash_Multi_Map_Manager (size_t size, ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0) | |
int | open (size_t size=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0) |
int | close (void) |
int | unbind_all (void) |
Removes all the entries in Hash_Multi_Map_Manager. | |
~ACE_Hash_Multi_Map_Manager (void) | |
Cleanup the Hash_Multi_Map_Manager. | |
int | bind (const EXT_ID &ext_id, const INT_ID &int_id) |
int | bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | bind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set) |
int | bind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | trybind (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) |
int | trybind (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Unbounded_Set< INT_ID > &old_int_id_set) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Unbounded_Set< INT_ID > &old_int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, EXT_ID &old_ext_id, ACE_Unbounded_Set< INT_ID > &old_int_id_set) |
int | rebind (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, EXT_ID &old_ext_id, ACE_Unbounded_Set< INT_ID > &old_int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | find (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) const |
int | find (const EXT_ID &ext_id, const INT_ID &int_id) const |
int | find (const EXT_ID &ext_id) const |
Returns 0 if the ext_id is in the mapping, otherwise -1. | |
int | find (const EXT_ID &ext_id, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) const |
int | unbind (const EXT_ID &ext_id) |
int | unbind (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) |
int | unbind (const EXT_ID &ext_id, const INT_ID &int_id) |
int | unbind (ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *entry) |
size_t | current_size (void) const |
size_t | total_size (void) const |
ACE_LOCK & | mutex (void) |
void | dump (void) const |
Dump the state of an object. | |
ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | begin (void) |
Return forward iterator. | |
ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | end (void) |
ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | rbegin (void) |
Return reverse iterator. | |
ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | rend (void) |
Protected Member Functions | |
int | equal (const EXT_ID &id1, const EXT_ID &id2) |
u_long | hash (const EXT_ID &ext_id) |
int | bind_i (const EXT_ID &ext_id, const INT_ID &int_id) |
Performs bind. Must be called with locks held. | |
int | bind_i (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs bind. Must be called with locks held. | |
int | bind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set) |
Performs bind. Must be called with locks held. | |
int | bind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs bind. Must be called with locks held. | |
int | trybind_i (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) |
Performs trybind. Must be called with locks held. | |
int | trybind_i (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs trybind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set) |
Performs rebind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs rebind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Unbounded_Set< INT_ID > &old_int_id) |
Performs rebind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, ACE_Unbounded_Set< INT_ID > &old_int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs rebind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, EXT_ID &old_ext_id, ACE_Unbounded_Set< INT_ID > &old_int_id_set) |
Performs rebind. Must be called with locks held. | |
int | rebind_i (const EXT_ID &ext_id, const ACE_Unbounded_Set< INT_ID > &int_id_set, EXT_ID &old_ext_id, ACE_Unbounded_Set< INT_ID > &old_int_id_set, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
Performs rebind. Must be called with locks held. | |
int | find_i (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) |
int | find_i (const EXT_ID &ext_id, const INT_ID &int_id) |
int | find_i (const EXT_ID &ext_id) |
int | find_i (const EXT_ID &ext_id, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry) |
int | unbind_i (const EXT_ID &ext_id, ACE_Unbounded_Set< INT_ID > &int_id_set) |
Performs unbind. Must be called with locks held. | |
int | unbind_i (const EXT_ID &ext_id, const INT_ID &int_id) |
Performs unbind. Must be called with locks held. | |
int | unbind_i (const EXT_ID &ext_id) |
Performs unbind. Must be called with locks held. | |
int | unbind_i (ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *entry) |
Performs unbind. Must be called with locks held. | |
int | create_buckets (size_t size) |
int | close_i (void) |
int | unbind_all_i (void) |
int | shared_find (const EXT_ID &ext_id, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *&entry, size_t &loc) |
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > * | table (void) |
Accessor of the underlying table. | |
size_t | cur_size (void) const |
Accessor of the current size attribute. | |
Protected Attributes | |
ACE_Allocator * | table_allocator_ |
ACE_Allocator * | entry_allocator_ |
ACE_LOCK | lock_ |
HASH_KEY | hash_key_ |
Function object used for hashing keys. | |
COMPARE_KEYS | compare_keys_ |
Function object used for comparing keys. | |
Private Member Functions | |
void | operator= (const ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &) |
ACE_Hash_Multi_Map_Manager (const ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &) | |
Private Attributes | |
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > * | table_ |
size_t | total_size_ |
Total size of the hash table. | |
size_t | cur_size_ |
Friends | |
class | ACE_Hash_Multi_Map_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
class | ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
class | ACE_Hash_Multi_Map_Const_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
class | ACE_Hash_Multi_Map_Const_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
class | ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
class | ACE_Hash_Multi_Map_Bucket_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
This implementation of a multi-map uses a hash table. Key hashing is achieved through the HASH_KEY
object and key comparison is achieved through the COMPARE_KEYS
object. This class uses an ACE_Allocator
to allocate memory. The user can make this a persistent class by providing an ACE_Allocator
with a persistable memory pool.
Definition at line 139 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator |
Definition at line 169 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::CONST_ITERATOR |
Definition at line 161 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ENTRY |
Definition at line 155 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator |
Definition at line 167 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ITERATOR |
Definition at line 159 of file Hash_Multi_Map_Manager_T.h.
typedef EXT_ID ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::KEY |
Definition at line 150 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_LOCK ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_type |
Definition at line 153 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator |
Definition at line 171 of file Hash_Multi_Map_Manager_T.h.
typedef ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::REVERSE_ITERATOR |
Definition at line 163 of file Hash_Multi_Map_Manager_T.h.
typedef INT_ID ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::VALUE |
Definition at line 152 of file Hash_Multi_Map_Manager_T.h.
ACE_INLINE ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Manager | ( | ACE_Allocator * | table_alloc = 0 , |
|
ACE_Allocator * | entry_alloc = 0 | |||
) |
Initialize a Hash_Multi_Map_Manager
with default size elements.
table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof ( ACE_Hash_Multi_Map_Entry<EXT_ID , INT_ID> ). | |
entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID , INT_ID> ) bytes each. If table_alloc is 0 it defaults to ACE_Allocator::instance() . If entry_alloc is 0 then it defaults to the same allocator as table_alloc. |
Definition at line 24 of file Hash_Multi_Map_Manager_T.inl.
References ACE_DEFAULT_MAP_SIZE, ACE_ERROR, ACE_TEXT, and LM_ERROR.
00026 : table_allocator_ (table_alloc), 00027 entry_allocator_ (entry_alloc), 00028 table_ (0), 00029 total_size_ (0), 00030 cur_size_ (0) 00031 { 00032 if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1) 00033 ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); 00034 }
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Manager | ( | size_t | size, | |
ACE_Allocator * | table_alloc = 0 , |
|||
ACE_Allocator * | entry_alloc = 0 | |||
) |
Initialize a Hash_Multi_Map_Manager
with size elements.
size | is the number of elements in a Hash_Multi_Map_Manager. | |
table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof ( ACE_Hash_Multi_Map_Entry<EXT_ID , <INT_ID> ). | |
entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID , INT_ID> ) bytes each. If table_alloc is 0 it defaults to ACE_Allocator::instance() . If entry_alloc is 0 then it defaults to the same allocator as table_alloc. |
Definition at line 10 of file Hash_Multi_Map_Manager_T.inl.
References ACE_ERROR, ACE_TEXT, and LM_ERROR.
00013 : table_allocator_ (table_alloc), 00014 entry_allocator_ (entry_alloc), 00015 table_ (0), 00016 total_size_ (0), 00017 cur_size_ (0) 00018 { 00019 if (this->open (size, table_alloc, entry_alloc) == -1) 00020 ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); 00021 }
ACE_INLINE ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Multi_Map_Manager | ( | void | ) |
Cleanup the Hash_Multi_Map_Manager.
Definition at line 53 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close().
00054 { 00055 this->close (); 00056 }
ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Manager | ( | const ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > & | ) | [private] |
ACE_INLINE ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin | ( | void | ) |
Return forward iterator.
Definition at line 425 of file Hash_Multi_Map_Manager_T.inl.
00426 { 00427 return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); 00428 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal bind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 137 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00140 { 00141 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00142 00143 return this->bind_i (ext_id, int_id_set, entry); 00144 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) |
Associate ext_id with int_id_set. If ext_id is already in the map then the ACE_Hash_Multi_Map_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.
Definition at line 128 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00130 { 00131 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00132 00133 return this->bind_i (ext_id, int_id_set); 00134 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal bind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 118 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00121 { 00122 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00123 00124 return this->bind_i (ext_id, int_id, entry); 00125 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) |
Associate ext_id with int_id. If ext_id and int_id is already in the map then the ACE_Hash_Multi_Map_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.
Definition at line 109 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00111 { 00112 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00113 00114 return this->bind_i (ext_id, int_id); 00115 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs bind. Must be called with locks held.
Definition at line 256 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_ALLOCATOR_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.
00259 { 00260 size_t loc; 00261 int result = this->shared_find (ext_id, entry, loc); 00262 00263 if (result == -1) 00264 { 00265 void *ptr; 00266 // Not found. 00267 ACE_ALLOCATOR_RETURN (ptr, 00268 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), 00269 -1); 00270 00271 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, 00272 int_id_set, 00273 this->table_[loc].next_, 00274 &this->table_[loc]); 00275 this->table_[loc].next_ = entry; 00276 entry->next_->prev_ = entry; 00277 this->cur_size_++; 00278 return 0; 00279 } 00280 else 00281 return 1; 00282 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | [protected] |
Performs bind. Must be called with locks held.
Definition at line 100 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00102 { 00103 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; 00104 00105 return this->bind_i (ext_id, int_id_set, temp); 00106 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs bind. Must be called with locks held.
Definition at line 214 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_ALLOCATOR_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_, ACE_Unbounded_Set_Ex< T, ACE_Unbounded_Set_Default_Comparator< T > >::insert(), ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::next_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.
00217 { 00218 size_t loc; 00219 int result = this->shared_find (ext_id, entry, loc); 00220 00221 ACE_Unbounded_Set<INT_ID> int_id_set; 00222 if (result == -1) 00223 { 00224 void *ptr; 00225 // Not found. 00226 ACE_ALLOCATOR_RETURN (ptr, 00227 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), 00228 -1); 00229 00230 int_id_set.insert (int_id); 00231 00232 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, 00233 int_id_set, 00234 this->table_[loc].next_, 00235 &this->table_[loc]); 00236 this->table_[loc].next_ = entry; 00237 entry->next_->prev_ = entry; 00238 this->cur_size_++; 00239 return 0; 00240 } 00241 else 00242 { 00243 int_id_set = (*entry).int_id_set_; 00244 00245 if (0 == int_id_set.insert (int_id)) 00246 { 00247 this->unbind_i (entry); 00248 return this->bind_i (ext_id, int_id_set); 00249 } 00250 else 00251 return 1; 00252 } 00253 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) | [protected] |
Performs bind. Must be called with locks held.
Definition at line 91 of file Hash_Multi_Map_Manager_T.inl.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().
00093 { 00094 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; 00095 00096 return this->bind_i (ext_id, int_id, temp); 00097 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close | ( | void | ) |
Close down a Hash_Multi_Map_Manager and release dynamically allocated resources.
Definition at line 37 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i().
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Multi_Map_Manager().
00038 { 00039 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00040 00041 return this->close_i (); 00042 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i | ( | void | ) | [protected] |
Close down a Map_Manager. Must be called with locks held.
Definition at line 150 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_DES_FREE_TEMPLATE2, ACE_NOOP, ACE_Allocator::free(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().
00151 { 00152 // Protect against "double-deletion" in case the destructor also 00153 // gets called. 00154 if (this->table_ != 0) 00155 { 00156 // Remove all the entries. 00157 this->unbind_all_i (); 00158 00159 // Iterate through the buckets cleaning up the sentinels. 00160 for (size_t i = 0; i < this->total_size_; i++) 00161 { 00162 // Destroy the dummy entry. 00163 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i]; 00164 00165 // The second argument results in a no-op instead of 00166 // deallocation. 00167 ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, 00168 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); 00169 } 00170 00171 // Reset size. 00172 this->total_size_ = 0; 00173 00174 // Free table memory. 00175 this->table_allocator_->free (this->table_); 00176 00177 // Should be done last... 00178 this->table_ = 0; 00179 } 00180 00181 return 0; 00182 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets | ( | size_t | size | ) | [protected] |
Resize the map. Must be called with locks held.
Definition at line 96 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_ALLOCATOR_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().
00097 { 00098 size_t bytes = size * sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>); 00099 void *ptr; 00100 00101 ACE_ALLOCATOR_RETURN (ptr, 00102 this->table_allocator_->malloc (bytes), 00103 -1); 00104 00105 this->table_ = (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *) ptr; 00106 00107 this->total_size_ = size; 00108 00109 // Initialize each entry in the hash table to be a circular linked 00110 // list with the dummy node in the front serving as the anchor of 00111 // the list. 00112 for (size_t i = 0; i < size; i++) 00113 new (&this->table_[i]) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], 00114 &this->table_[i]); 00115 return 0; 00116 }
ACE_INLINE size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size | ( | void | ) | const [protected] |
Accessor of the current size attribute.
Definition at line 460 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_.
00461 { 00462 return this->cur_size_; 00463 }
ACE_INLINE size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size | ( | void | ) | const |
Returns the current number of ACE_Hash_Multi_Map_Entry
objects in the hash table.
Definition at line 59 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_.
00060 { 00061 return this->cur_size_; 00062 }
void ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump | ( | void | ) | const |
Dump the state of an object.
Definition at line 82 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_Allocator::dump(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_, LM_DEBUG, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_.
00083 { 00084 #if defined (ACE_HAS_DUMP) 00085 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00086 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d"), this->total_size_)); 00087 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_)); 00088 this->table_allocator_->dump (); 00089 this->entry_allocator_->dump (); 00090 this->lock_.dump (); 00091 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00092 #endif /* ACE_HAS_DUMP */ 00093 }
ACE_INLINE ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end | ( | void | ) |
Definition at line 432 of file Hash_Multi_Map_Manager_T.inl.
00433 { 00434 return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); 00435 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal | ( | const EXT_ID & | id1, | |
const EXT_ID & | id2 | |||
) | [protected] |
Returns 1 if id1 == id2, else 0. This is defined as a separate method to facilitate template specialization.
Definition at line 84 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::compare_keys_.
00086 { 00087 return this->compare_keys_ (id1, id2); 00088 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id, | |
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | const |
Locate ext_id and pass out parameter via entry. If found, return 0, returns -1 if not found.
Definition at line 309 of file Hash_Multi_Map_Manager_T.inl.
References ACE_READ_GUARD_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_.
00311 { 00312 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00313 const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00314 (this); 00315 00316 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); 00317 00318 return nc_this->find_i (ext_id, entry); 00319 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id | ) | const |
Returns 0 if the ext_id is in the mapping, otherwise -1.
Definition at line 289 of file Hash_Multi_Map_Manager_T.inl.
References ACE_READ_GUARD_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_.
00290 { 00291 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00292 const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00293 (this); 00294 00295 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); 00296 00297 return nc_this->find_i (ext_id); 00298 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) | const |
Locate ext_id and int_id. Return 0 if found, returns -1 if not found.
Definition at line 276 of file Hash_Multi_Map_Manager_T.inl.
References ACE_READ_GUARD_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_.
00278 { 00279 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00280 const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00281 (this); 00282 00283 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); 00284 00285 return nc_this->find_i (ext_id, int_id); 00286 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | const |
Locate ext_id and pass out parameter via int_id_set. Return 0 if found, returns -1 if not found.
Definition at line 263 of file Hash_Multi_Map_Manager_T.inl.
References ACE_READ_GUARD_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_.
00265 { 00266 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00267 const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00268 (this); 00269 00270 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); 00271 00272 return nc_this->find_i (ext_id, int_id_set); 00273 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id, | |
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs a find using ext_id as the key. Must be called with locks held.
Definition at line 301 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().
00303 { 00304 size_t dummy; 00305 return this->shared_find (ext_id, entry, dummy); 00306 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id | ) | [protected] |
Performs a find using ext_id as the key. Must be called with locks held.
Definition at line 254 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().
00255 { 00256 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; 00257 00258 size_t dummy; 00259 return this->shared_find (ext_id, entry, dummy); 00260 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) | [protected] |
Performs a find of ext_id and int_id. Must be called with locks held.
Definition at line 236 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Unbounded_Set_Ex< T, C >::find(), and ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
00238 { 00239 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; 00240 00241 size_t dummy; 00242 if (this->shared_find (ext_id, entry, dummy) == -1) 00243 return -1; 00244 else 00245 { 00246 if (0 == entry->int_id_set_.find (int_id)) 00247 return 0; 00248 else 00249 return -1; 00250 } 00251 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | [protected] |
Performs a find of int_id_set using ext_id as the key. Must be called with locks held.
Definition at line 220 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find().
00222 { 00223 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; 00224 00225 size_t dummy; 00226 if (this->shared_find (ext_id, entry, dummy) == -1) 00227 return -1; 00228 else 00229 { 00230 int_id_set = entry->int_id_set_; 00231 return 0; 00232 } 00233 }
ACE_INLINE u_long ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash | ( | const EXT_ID & | ext_id | ) | [protected] |
Compute the hash value of the ext_id. This is defined as a separate method to facilitate template specialization.
Definition at line 78 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash_key_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().
00079 { 00080 return this->hash_key_ (ext_id); 00081 }
ACE_INLINE ACE_LOCK & ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::mutex | ( | void | ) |
Returns a reference to the underlying ACE_LOCK
. This makes it possible to acquire the lock explicitly, which can be useful in some cases if you instantiate the ACE_Atomic_Op
with an ACE_Recursive_Mutex
or ACE_Process_Mutex
, or if you need to guard the state of an iterator.
Definition at line 71 of file Hash_Multi_Map_Manager_T.inl.
References ACE_TRACE, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_.
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open | ( | size_t | size = ACE_DEFAULT_MAP_SIZE , |
|
ACE_Allocator * | table_alloc = 0 , |
|||
ACE_Allocator * | entry_alloc = 0 | |||
) |
Initialize a Hash_Multi_Map_Manager
with size elements.
size | is the number of elements in a Hash_Multi_Map_Manager. | |
table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID , <INT_ID> ). | |
entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID , <INT_ID> ) bytes each. If table_alloc is 0 it defaults to ACE_Allocator::instance() . If entry_alloc is 0 then it defaults to the same allocator as table_alloc. |
Definition at line 119 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_WRITE_GUARD_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_, ACE_Allocator::instance(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_.
00122 { 00123 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00124 00125 // Calling this->close_i () to ensure we release previous allocated 00126 // memory before allocating new one. 00127 this->close_i (); 00128 00129 if (table_alloc == 0) 00130 table_alloc = ACE_Allocator::instance (); 00131 00132 this->table_allocator_ = table_alloc; 00133 00134 if (entry_alloc == 0) 00135 entry_alloc = table_alloc; 00136 00137 this->entry_allocator_ = entry_alloc; 00138 00139 // This assertion is here to help track a situation that shouldn't 00140 // happen, but did with Sun C++ 4.1 (before a change to this class 00141 // was made: it used to have an enum that was supposed to be defined 00142 // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). 00143 if (size == 0) 00144 return -1; 00145 00146 return this->create_buckets (size); 00147 }
void ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator= | ( | const ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > & | ) | [private] |
ACE_INLINE ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rbegin | ( | void | ) |
Return reverse iterator.
Definition at line 439 of file Hash_Multi_Map_Manager_T.inl.
00440 { 00441 return ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); 00442 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
EXT_ID & | old_ext_id, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal rebind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 412 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00417 { 00418 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00419 00420 return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set, entry); 00421 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
EXT_ID & | old_ext_id, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set | |||
) |
Associate ext_id with int_id_set. If ext_id is not in the map then behaves just like bind. Otherwise, store the old values of ext_id and int_id_set into the "out" parameters and rebind the new parameters. This is very useful if you need to have an atomic way of updating ACE_Hash_Multi_Map_Entry
objects and you also need full control over memory allocation. Returns 0 if a new entry is bound successfully, returns 1 if an existing entry was rebound, and returns -1 if failures occur.
Definition at line 401 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00405 { 00406 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00407 00408 return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set); 00409 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal rebind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 390 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00394 { 00395 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00396 00397 return this->rebind_i (ext_id, int_id_set, old_int_id_set, entry); 00398 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set | |||
) |
Associate ext_id with int_id_set. If ext_id is not in the map then behaves just like bind. Otherwise, store the old value of int_id_set into the "out" parameter and rebind the new parameters. Returns 0 if a new entry is bound successfully, returns 1 if an existing entry was rebound, and returns -1 if failures occur.
Definition at line 380 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00383 { 00384 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00385 00386 return this->rebind_i (ext_id, int_id_set, old_int_id_set); 00387 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal rebind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 370 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00373 { 00374 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00375 00376 return this->rebind_i (ext_id, int_id_set, entry); 00377 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) |
Reassociate ext_id with int_id_set. If ext_id is not in the map then behaves just like bind. Returns 0 if a new entry is bound successfully, returns 1 if an existing entry was rebound, and returns -1 if failures occur.
Definition at line 361 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00363 { 00364 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00365 00366 return this->rebind_i (ext_id, int_id_set); 00367 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
EXT_ID & | old_ext_id, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 436 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::ext_id_, and ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
00441 { 00442 size_t dummy; 00443 if (this->shared_find (ext_id, entry, dummy) == -1) 00444 return this->bind_i (ext_id, int_id_set); 00445 else 00446 { 00447 old_ext_id = entry->ext_id_; 00448 old_int_id_set = entry->int_id_set_; 00449 entry->ext_id_ = ext_id; 00450 entry->int_id_set_ = int_id_set; 00451 return 1; 00452 } 00453 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
EXT_ID & | old_ext_id, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 346 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00350 { 00351 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; 00352 00353 return this->rebind_i (ext_id, 00354 int_id_set, 00355 old_ext_id, 00356 old_int_id_set, 00357 node); 00358 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 418 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::ext_id_, and ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
00422 { 00423 size_t dummy; 00424 if (this->shared_find (ext_id, entry, dummy) == -1) 00425 return this->bind_i (ext_id, int_id_set); 00426 else 00427 { 00428 old_int_id_set = entry->int_id_set_; 00429 entry->ext_id_ = ext_id; 00430 entry->int_id_set_ = int_id_set; 00431 return 1; 00432 } 00433 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Unbounded_Set< INT_ID > & | old_int_id | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 333 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00336 { 00337 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; 00338 00339 return this->rebind_i (ext_id, 00340 int_id_set, 00341 old_int_id_set, 00342 node); 00343 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 402 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::ext_id_, and ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
00405 { 00406 size_t dummy; 00407 if (this->shared_find (ext_id, entry, dummy) == -1) 00408 return this->bind_i (ext_id, int_id_set); 00409 else 00410 { 00411 entry->ext_id_ = ext_id; 00412 entry->int_id_set_ = int_id_set; 00413 return 1; 00414 } 00415 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
const ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | [protected] |
Performs rebind. Must be called with locks held.
Definition at line 322 of file Hash_Multi_Map_Manager_T.inl.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().
00324 { 00325 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; 00326 00327 return this->rebind_i (ext_id, 00328 int_id_set, 00329 node); 00330 }
ACE_INLINE ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rend | ( | void | ) |
Definition at line 446 of file Hash_Multi_Map_Manager_T.inl.
00447 { 00448 return ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); 00449 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find | ( | const EXT_ID & | ext_id, | |
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry, | |||
size_t & | loc | |||
) | [protected] |
Returns the ACE_Hash_Multi_Map_Entry
object that corresponds to ext_id.
Definition at line 378 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::ext_id_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash(), ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::next_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00381 { 00382 loc = this->hash (ext_id) % this->total_size_; 00383 00384 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_; 00385 00386 while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) 00387 temp = temp->next_; 00388 00389 if (temp == &this->table_[loc]) 00390 { 00391 errno = ENOENT; 00392 return -1; 00393 } 00394 else 00395 { 00396 entry = temp; 00397 return 0; 00398 } 00399 }
ACE_INLINE ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > * ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table | ( | void | ) | [protected] |
Accessor of the underlying table.
Definition at line 453 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.
00454 { 00455 return this->table_; 00456 }
ACE_INLINE size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size | ( | void | ) | const |
Return the size of the array that's used to point to the linked lists of ACE_Hash_Multi_Map_Entry
objects in the hash table.
Definition at line 65 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_.
00066 { 00067 return this->total_size_; 00068 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) |
Same as a normal trybind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.
Definition at line 168 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i().
00171 { 00172 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00173 00174 return this->trybind_i (ext_id, int_id_set, entry); 00175 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) |
Associate ext_id with int_id_set if and only if ext_id is not in the map. If ext_id is already in the map then the int_id_set parameter is assigned the existing value in the map. 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.
Definition at line 159 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i().
00161 { 00162 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00163 00164 return this->trybind_i (ext_id, int_id_set); 00165 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set, | |||
ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
) | [protected] |
Performs trybind. Must be called with locks held.
Definition at line 285 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_ALLOCATOR_RETURN, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.
00288 { 00289 size_t loc; 00290 int result = this->shared_find (ext_id, entry, loc); 00291 00292 if (result == -1) 00293 { 00294 // Not found. 00295 void *ptr; 00296 ACE_ALLOCATOR_RETURN (ptr, 00297 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), 00298 -1); 00299 00300 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, 00301 int_id_set, 00302 this->table_[loc].next_, 00303 &this->table_[loc]); 00304 this->table_[loc].next_ = entry; 00305 entry->next_->prev_ = entry; 00306 this->cur_size_++; 00307 return 0; 00308 } 00309 else 00310 return 1; 00311 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | [protected] |
Performs trybind. Must be called with locks held.
Definition at line 147 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind().
00149 { 00150 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; 00151 00152 int result = this->trybind_i (ext_id, int_id_set, temp); 00153 if (result == 1) 00154 int_id_set = temp->int_id_set_; 00155 return result; 00156 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > * | entry | ) |
Remove entry from map. Return 0 if the unbind was successfully, and returns -1 if failures occur.
Definition at line 212 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00213 { 00214 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00215 00216 return this->unbind_i (entry) == -1 ? -1 : 0; 00217 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) |
Break any association of ext_id and int_id. Return 0 if the unbind was successfully, and returns -1 if failures occur.
Definition at line 195 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00197 { 00198 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00199 00200 return this->unbind_i (ext_id, int_id); 00201 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) |
Break any association of ext_id. Returns the value of int_id_set in case the caller needs to deallocate memory. Return 0 if the unbind was successfully, and returns -1 if failures occur.
Definition at line 186 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00188 { 00189 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00190 00191 return this->unbind_i (ext_id, int_id_set); 00192 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | const EXT_ID & | ext_id | ) |
Unbind (remove) the ext_id from the map. Don't return the int_id to the caller (this is useful for collections where the int_ids are *not* dynamically allocated...)
Definition at line 204 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00205 { 00206 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00207 00208 return this->unbind_i (ext_id) == -1 ? -1 : 0; 00209 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all | ( | void | ) |
Removes all the entries in Hash_Multi_Map_Manager.
Definition at line 45 of file Hash_Multi_Map_Manager_T.inl.
References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().
00046 { 00047 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00048 00049 return this->unbind_all_i (); 00050 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i | ( | void | ) | [protected] |
Removes all the entries in Map_Manager. Must be called with locks held.
Definition at line 185 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_DES_FREE_TEMPLATE2, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all().
00186 { 00187 // Iterate through the entire map calling the destuctor of each 00188 // <ACE_Hash_Multi_Map_Entry>. 00189 for (size_t i = 0; i < this->total_size_; i++) 00190 { 00191 for (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; 00192 temp_ptr != &this->table_[i]; 00193 ) 00194 { 00195 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr; 00196 temp_ptr = temp_ptr->next_; 00197 00198 // Explicitly call the destructor. 00199 ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free, 00200 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); 00201 } 00202 00203 // Restore the sentinel. 00204 this->table_[i].next_ = &this->table_[i]; 00205 this->table_[i].prev_ = &this->table_[i]; 00206 } 00207 00208 this->cur_size_ = 0; 00209 00210 return 0; 00211 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID > * | entry | ) | [protected] |
Performs unbind. Must be called with locks held.
Definition at line 334 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_DES_FREE_TEMPLATE2, ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_, ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::next_, and ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::prev_.
00335 { 00336 entry->next_->prev_ = entry->prev_; 00337 entry->prev_->next_ = entry->next_; 00338 00339 // Explicitly call the destructor. 00340 ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free, 00341 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); 00342 00343 this->cur_size_--; 00344 return 0; 00345 }
ACE_INLINE int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | const EXT_ID & | ext_id | ) | [protected] |
Performs unbind. Must be called with locks held.
Definition at line 178 of file Hash_Multi_Map_Manager_T.inl.
References ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00179 { 00180 ACE_Unbounded_Set<INT_ID> int_id_set; 00181 00182 return this->unbind_i (ext_id, int_id_set); 00183 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | const EXT_ID & | ext_id, | |
const INT_ID & | int_id | |||
) | [protected] |
Performs unbind. Must be called with locks held.
Definition at line 348 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Unbounded_Set_Ex< T, ACE_Unbounded_Set_Default_Comparator< T > >::remove(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Unbounded_Set_Ex< T, ACE_Unbounded_Set_Default_Comparator< T > >::size().
00350 { 00351 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; 00352 00353 size_t loc; 00354 int result = this->shared_find (ext_id, temp, loc); 00355 00356 if (result == -1) 00357 { 00358 errno = ENOENT; 00359 return -1; 00360 } 00361 00362 ACE_Unbounded_Set<INT_ID> int_id_set = (*temp).int_id_set_; 00363 if (0 == int_id_set.remove (int_id)) 00364 { 00365 this->unbind_i (temp); 00366 00367 if (0 != int_id_set.size ()) 00368 return this->bind_i (ext_id, int_id_set); 00369 else 00370 return 0; 00371 } 00372 else 00373 return -1; 00374 }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | const EXT_ID & | ext_id, | |
ACE_Unbounded_Set< INT_ID > & | int_id_set | |||
) | [protected] |
Performs unbind. Must be called with locks held.
Definition at line 314 of file Hash_Multi_Map_Manager_T.cpp.
References ACE_Hash_Multi_Map_Entry< EXT_ID, INT_ID >::int_id_set_, and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
00316 { 00317 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; 00318 00319 size_t loc; 00320 int result = this->shared_find (ext_id, temp, loc); 00321 00322 if (result == -1) 00323 { 00324 errno = ENOENT; 00325 return -1; 00326 } 00327 00328 int_id_set = temp->int_id_set_; 00329 00330 return this->unbind_i (temp); 00331 }
friend class ACE_Hash_Multi_Map_Bucket_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 147 of file Hash_Multi_Map_Manager_T.h.
friend class ACE_Hash_Multi_Map_Const_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 145 of file Hash_Multi_Map_Manager_T.h.
friend class ACE_Hash_Multi_Map_Const_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 144 of file Hash_Multi_Map_Manager_T.h.
friend class ACE_Hash_Multi_Map_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 143 of file Hash_Multi_Map_Manager_T.h.
friend class ACE_Hash_Multi_Map_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 142 of file Hash_Multi_Map_Manager_T.h.
friend class ACE_Hash_Multi_Map_Reverse_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 146 of file Hash_Multi_Map_Manager_T.h.
COMPARE_KEYS ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::compare_keys_ [protected] |
Function object used for comparing keys.
Definition at line 568 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal().
size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_ [private] |
Current number of entries in the table
Definition at line 597 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().
ACE_Allocator* ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_ [protected] |
Addidtional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof (ACE_Hash_Multi_Map_Entry<
EXT_ID
,INT_ID>
) bytes each.
Definition at line 558 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().
HASH_KEY ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash_key_ [protected] |
Function object used for hashing keys.
Definition at line 565 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash().
ACE_LOCK ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_ [protected] |
Synchronization variable for the MT_SAFE ACE_Hash_Multi_Map_Manager
.
Definition at line 562 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::mutex().
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>* ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_ [private] |
Array of the pointers to ACE_Hash_Multi_Map_Entry
objects, each of which points to an ACE_Hash_Multi_Map_Entry
that serves as the beginning of a linked list of EXT_ID
that hash to that bucket.
Definition at line 589 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Const_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Const_Iterator_Base(), ACE_Hash_Multi_Map_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Iterator_Base(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().
ACE_Allocator* ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_ [protected] |
Pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Multi_Map_Entry<
EXT_ID
,INT_ID>
),
Definition at line 553 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().
size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_ [private] |
Total size of the hash table.
Definition at line 592 of file Hash_Multi_Map_Manager_T.h.
Referenced by ACE_Hash_Multi_Map_Const_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Const_Iterator_Base(), ACE_Hash_Multi_Map_Iterator_Base< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Multi_Map_Iterator_Base(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size(), and ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().