Define a map abstraction that efficiently associates EXT_ID type objects with INT_ID type objects.
More...
#include <Hash_Map_Manager_T.h>

Public Types | |
| typedef EXT_ID | KEY |
| typedef INT_ID | VALUE |
| typedef ACE_LOCK | lock_type |
| typedef ACE_Hash_Map_Entry < EXT_ID, INT_ID > | ENTRY |
| typedef ACE_Hash_Map_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | ITERATOR |
| typedef ACE_Hash_Map_Const_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | CONST_ITERATOR |
| typedef ACE_Hash_Map_Reverse_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | REVERSE_ITERATOR |
| typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | CONST_REVERSE_ITERATOR |
| typedef ACE_Hash_Map_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | iterator |
| typedef ACE_Hash_Map_Const_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | const_iterator |
| typedef ACE_Hash_Map_Reverse_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | reverse_iterator |
| typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex < EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > | const_reverse_iterator |
| typedef EXT_ID | key_type |
| typedef INT_ID | data_type |
| typedef ACE_Hash_Map_Entry < EXT_ID, INT_ID > | value_type |
| typedef value_type & | reference |
| typedef value_type const & | const_reference |
| typedef value_type * | pointer |
| typedef value_type const * | const_pointer |
| typedef ptrdiff_t | difference_type |
| typedef size_t | size_type |
Public Member Functions | |
| ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0) | |
| ACE_Hash_Map_Manager_Ex (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 the ACE_Hash_Map_Manager_Ex. | |
| ~ACE_Hash_Map_Manager_Ex (void) | |
| Cleanup the ACE_Hash_Map_Manager_Ex. | |
| int | bind (const EXT_ID &item, const INT_ID &int_id) |
| int | bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | trybind (const EXT_ID &ext_id, INT_ID &int_id) |
| int | trybind (const EXT_ID &ext_id, INT_ID &int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) |
| int | rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | find (const EXT_ID &ext_id, 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_Map_Entry< EXT_ID, INT_ID > *&entry) const |
| void | find (EXT_ID const &ext_id, iterator &pos) const |
| int | unbind (const EXT_ID &ext_id) |
| int | unbind (const EXT_ID &ext_id, INT_ID &int_id) |
| int | unbind (ACE_Hash_Map_Entry< EXT_ID, INT_ID > *entry) |
| Remove entry from map. | |
| int | unbind (iterator pos) |
Remove entry from map pointed to by iterator pos. | |
| 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. | |
| iterator | begin (void) |
| Return forward iterator. | |
| iterator | end (void) |
| const_iterator | begin (void) const |
| const_iterator | end (void) const |
| reverse_iterator | rbegin (void) |
| Return reverse iterator. | |
| reverse_iterator | rend (void) |
| const_reverse_iterator | rbegin (void) const |
| const_reverse_iterator | rend (void) const |
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_Map_Entry< EXT_ID, INT_ID > *&entry) |
| Performs bind. Must be called with locks held. | |
| int | trybind_i (const EXT_ID &ext_id, INT_ID &int_id) |
| Performs trybind. Must be called with locks held. | |
| int | trybind_i (const EXT_ID &ext_id, INT_ID &int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| Performs trybind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id) |
| Performs rebind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| Performs rebind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id) |
| Performs rebind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| Performs rebind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) |
| Performs rebind. Must be called with locks held. | |
| int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| Performs rebind. Must be called with locks held. | |
| int | find_i (const EXT_ID &ext_id, INT_ID &int_id) |
| int | find_i (const EXT_ID &ext_id) |
| int | find_i (const EXT_ID &ext_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry) |
| int | unbind_i (const EXT_ID &ext_id, 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_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_Map_Entry< EXT_ID, INT_ID > *&entry, size_t &loc) |
| Returns the ACE_Hash_Map_Entry that corresponds to ext_id. | |
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > * | table (void) |
| Accessor of the underlying table. | |
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 | |
| ACE_UNIMPLEMENTED_FUNC (void operator=(const ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &)) ACE_UNIMPLEMENTED_FUNC(ACE_Hash_Map_Manager_Ex(const ACE_Hash_Map_Manager_Ex< EXT_ID | |
Private Attributes | |
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > * | table_ |
| size_t | total_size_ |
| Total size of the hash table. | |
| size_t | cur_size_ |
| INT_ID | |
| HASH_KEY | |
| COMPARE_KEYS | |
Friends | |
| class | ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Const_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Const_Reverse_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
| class | ACE_Hash_Map_Bucket_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > |
Define a map abstraction that efficiently associates EXT_ID type objects with INT_ID type objects.
This implementation of a 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 129 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator |
Definition at line 162 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::CONST_ITERATOR |
Definition at line 152 of file Hash_Map_Manager_T.h.
| typedef value_type const* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_pointer |
Definition at line 175 of file Hash_Map_Manager_T.h.
| typedef value_type const& ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_reference |
Definition at line 173 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_reverse_iterator |
Definition at line 166 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::CONST_REVERSE_ITERATOR |
Definition at line 156 of file Hash_Map_Manager_T.h.
| typedef INT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::data_type |
Definition at line 170 of file Hash_Map_Manager_T.h.
| typedef ptrdiff_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::difference_type |
Definition at line 176 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ENTRY |
Definition at line 146 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator |
Definition at line 160 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ITERATOR |
Definition at line 150 of file Hash_Map_Manager_T.h.
| typedef EXT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::KEY |
Definition at line 141 of file Hash_Map_Manager_T.h.
| typedef EXT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::key_type |
Definition at line 169 of file Hash_Map_Manager_T.h.
| typedef ACE_LOCK ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_type |
Definition at line 144 of file Hash_Map_Manager_T.h.
| typedef value_type* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::pointer |
Definition at line 174 of file Hash_Map_Manager_T.h.
| typedef value_type& ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reference |
Definition at line 172 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator |
Definition at line 164 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::REVERSE_ITERATOR |
Definition at line 154 of file Hash_Map_Manager_T.h.
| typedef size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::size_type |
Definition at line 177 of file Hash_Map_Manager_T.h.
| typedef INT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::VALUE |
Definition at line 143 of file Hash_Map_Manager_T.h.
| typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::value_type |
Definition at line 171 of file Hash_Map_Manager_T.h.
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex | ( | ACE_Allocator * | table_alloc = 0, |
|
| ACE_Allocator * | entry_alloc = 0 | |||
| ) | [inline] |
Initialize an ACE_Hash_Map_Manager_Ex with a default number of elements.
| table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance(). | |
| entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 it defaults to the same allocator as table_alloc. |
Definition at line 24 of file Hash_Map_Manager_T.inl.
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 ("%p\n"), 00034 ACE_TEXT ("ACE_Hash_Map_Manager_Ex open"))); 00035 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex | ( | size_t | size, | |
| ACE_Allocator * | table_alloc = 0, |
|||
| ACE_Allocator * | entry_alloc = 0 | |||
| ) | [inline] |
Initialize an ACE_Hash_Map_Manager_Ex with size elements.
| table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance(). | |
| entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 it defaults to the same allocator as table_alloc. |
Definition at line 10 of file Hash_Map_Manager_T.inl.
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_Map_Manager_Ex\n"))); 00021 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Map_Manager_Ex | ( | void | ) | [inline] |
Cleanup the ACE_Hash_Map_Manager_Ex.
Definition at line 54 of file Hash_Map_Manager_T.inl.
00055 { 00056 this->close (); 00057 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_UNIMPLEMENTED_FUNC | ( | void | operator = (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) |
) | const [private] |
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin | ( | void | ) | const [inline] |
Definition at line 392 of file Hash_Map_Manager_T.inl.
00393 { 00394 return const_iterator (*this); 00395 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin | ( | void | ) | [inline] |
Return forward iterator.
Definition at line 378 of file Hash_Map_Manager_T.inl.
00379 { 00380 return iterator (*this); 00381 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline] |
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 110 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind | ( | const EXT_ID & | item, | |
| const INT_ID & | int_id | |||
| ) | [inline] |
Associate item with int_id. If item is already in the map then the map is not changed.
| 0 | if a new entry is bound successfully. | |
| 1 | if an attempt is made to bind an existing entry. | |
| -1 | if a failure occurs; check errno for more information. |
Definition at line 101 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs bind. Must be called with locks held.
Definition at line 223 of file Hash_Map_Manager_T.cpp.
00226 { 00227 size_t loc = 0; 00228 if (this->shared_find (ext_id, entry, loc) == -1) 00229 { 00230 void *ptr = 0; 00231 // Not found. 00232 ACE_ALLOCATOR_RETURN (ptr, 00233 this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), 00234 -1); 00235 00236 entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, 00237 int_id, 00238 this->table_[loc].next_, 00239 &this->table_[loc]); 00240 this->table_[loc].next_ = entry; 00241 entry->next_->prev_ = entry; 00242 ++this->cur_size_; 00243 return 0; 00244 } 00245 else 00246 return 1; 00247 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id | |||
| ) | [inline, protected] |
Performs bind. Must be called with locks held.
Definition at line 92 of file Hash_Map_Manager_T.inl.
00094 { 00095 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; 00096 00097 return this->bind_i (ext_id, int_id, temp); 00098 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close | ( | void | ) | [inline] |
Close down the ACE_Hash_Map_Manager_Ex and release dynamically allocated resources.
Definition at line 38 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i | ( | void | ) | [inline, protected] |
Close down a <Map_Manager_Ex>. Must be called with locks held.
Definition at line 159 of file Hash_Map_Manager_T.cpp.
00160 { 00161 // Protect against "double-deletion" in case the destructor also 00162 // gets called. 00163 if (this->table_ != 0) 00164 { 00165 // Remove all the entries. 00166 this->unbind_all_i (); 00167 00168 // Iterate through the buckets cleaning up the sentinels. 00169 for (size_t i = 0; i < this->total_size_; i++) 00170 { 00171 // Destroy the dummy entry. 00172 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i]; 00173 00174 // The second argument results in a no-op instead of 00175 // deallocation. 00176 ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, 00177 ACE_Hash_Map_Entry, EXT_ID, INT_ID); 00178 } 00179 00180 // Reset size. 00181 this->total_size_ = 0; 00182 00183 // Free table memory. 00184 this->table_allocator_->free (this->table_); 00185 00186 // Should be done last... 00187 this->table_ = 0; 00188 } 00189 00190 return 0; 00191 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets | ( | size_t | size | ) | [inline, protected] |
Resize the map. Must be called with locks held.
Definition at line 105 of file Hash_Map_Manager_T.cpp.
00106 { 00107 size_t bytes = size * sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>); 00108 void *ptr = 0; 00109 00110 ACE_ALLOCATOR_RETURN (ptr, 00111 this->table_allocator_->malloc (bytes), 00112 -1); 00113 00114 this->table_ = (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *) ptr; 00115 00116 this->total_size_ = size; 00117 00118 // Initialize each entry in the hash table to be a circular linked 00119 // list with the dummy node in the front serving as the anchor of 00120 // the list. 00121 for (size_t i = 0; i < size; i++) 00122 new (&this->table_[i]) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], 00123 &this->table_[i]); 00124 return 0; 00125 }
| size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size | ( | void | ) | const [inline] |
Returns the current number of ACE_Hash_Map_Entry objects in the hash table.
Definition at line 60 of file Hash_Map_Manager_T.inl.
00061 { 00062 return this->cur_size_; 00063 }
| void ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump | ( | void | ) | const [inline] |
Dump the state of an object.
Definition at line 91 of file Hash_Map_Manager_T.cpp.
00092 { 00093 #if defined (ACE_HAS_DUMP) 00094 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00095 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d\n"), this->total_size_)); 00096 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("cur_size_ = %d\n"), this->cur_size_)); 00097 this->table_allocator_->dump (); 00098 this->entry_allocator_->dump (); 00099 this->lock_.dump (); 00100 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00101 #endif /* ACE_HAS_DUMP */ 00102 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end | ( | void | ) | const [inline] |
Definition at line 399 of file Hash_Map_Manager_T.inl.
00400 { 00401 return const_iterator (*this, 1); 00402 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end | ( | void | ) | [inline] |
Definition at line 385 of file Hash_Map_Manager_T.inl.
00386 { 00387 return iterator (*this, 1); 00388 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal | ( | const EXT_ID & | id1, | |
| const EXT_ID & | id2 | |||
| ) | [inline, protected] |
Returns 1 if <id1> == <id2>, else 0. This is defined as a separate method to facilitate template specialization.
Reimplemented in ACE_Hash_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >.
Definition at line 85 of file Hash_Map_Manager_T.inl.
00087 { 00088 return this->compare_keys_ (id1, id2); 00089 }
| void ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | EXT_ID const & | ext_id, | |
| typename ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator & | pos | |||
| ) | const [inline] |
Locate ext_id and pass out an iterator that points to its corresponding value.
| pos | pos will be set to end() if not found. |
Definition at line 449 of file Hash_Map_Manager_T.inl.
00456 { 00457 ENTRY * entry = 0; 00458 size_t index = 0; 00459 00460 ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00461 const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00462 (this); 00463 00464 ACE_READ_GUARD (ACE_LOCK, ace_mon, this->lock_); 00465 00466 if (nc_this->shared_find (ext_id, entry, index) != -1) 00467 pos = iterator (*nc_this, entry, index); 00468 else 00469 pos = nc_this->end (); 00470 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id, | |
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | const [inline] |
Locate ext_id and pass out parameter via entry. If found, return 0, returns -1 if not found.
Definition at line 262 of file Hash_Map_Manager_T.inl.
00264 { 00265 ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00266 const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00267 (this); 00268 00269 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00270 00271 return nc_this->find_i (ext_id, entry); 00272 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id | ) | const [inline] |
Returns 0 if the ext_id is in the mapping, otherwise -1.
Definition at line 242 of file Hash_Map_Manager_T.inl.
00243 { 00244 ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00245 const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00246 (this); 00247 00248 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00249 00250 return nc_this->find_i (ext_id); 00251 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | const [inline] |
Locate ext_id and pass out parameter via int_id. Return 0 if found, returns -1 if not found.
Definition at line 229 of file Hash_Map_Manager_T.inl.
00231 { 00232 ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = 00233 const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> 00234 (this); 00235 00236 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00237 00238 return nc_this->find_i (ext_id, int_id); 00239 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id, | |
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs a find using ext_id as the key. Must be called with locks held.
Definition at line 254 of file Hash_Map_Manager_T.inl.
00256 { 00257 size_t dummy; 00258 return this->shared_find (ext_id, entry, dummy); 00259 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id | ) | [inline, protected] |
Performs a find using ext_id as the key. Must be called with locks held.
Definition at line 220 of file Hash_Map_Manager_T.inl.
00221 { 00222 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; 00223 00224 size_t dummy; 00225 return this->shared_find (ext_id, entry, dummy); 00226 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | [inline, protected] |
Performs a find of int_id using ext_id as the key. Must be called with locks held.
Definition at line 204 of file Hash_Map_Manager_T.inl.
00206 { 00207 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; 00208 00209 size_t dummy; 00210 if (this->shared_find (ext_id, entry, dummy) == -1) 00211 return -1; 00212 else 00213 { 00214 int_id = entry->int_id_; 00215 return 0; 00216 } 00217 }
| u_long ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash | ( | const EXT_ID & | ext_id | ) | [inline, protected] |
Compute the hash value of the ext_id. This is defined as a separate method to facilitate template specialization.
Reimplemented in ACE_Hash_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >.
Definition at line 79 of file Hash_Map_Manager_T.inl.
00080 { 00081 return this->hash_key_ (ext_id); 00082 }
| ACE_LOCK & ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::mutex | ( | void | ) | [inline] |
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 72 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< 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 | |||
| ) | [inline] |
Initialize an ACE_Hash_Map_Manager_Ex with size elements.
| table_alloc | is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance(). | |
| entry_alloc | is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 then it defaults to the same allocator as table_alloc. |
Definition at line 128 of file Hash_Map_Manager_T.cpp.
00131 { 00132 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00133 00134 // Calling this->close_i () to ensure we release previous allocated 00135 // memory before allocating new one. 00136 this->close_i (); 00137 00138 if (table_alloc == 0) 00139 table_alloc = ACE_Allocator::instance (); 00140 00141 this->table_allocator_ = table_alloc; 00142 00143 if (entry_alloc == 0) 00144 entry_alloc = table_alloc; 00145 00146 this->entry_allocator_ = entry_alloc; 00147 00148 // This assertion is here to help track a situation that shouldn't 00149 // happen, but did with Sun C++ 4.1 (before a change to this class 00150 // was made: it used to have an enum that was supposed to be defined 00151 // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). 00152 if (size == 0) 00153 return -1; 00154 00155 return this->create_buckets (size); 00156 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rbegin | ( | void | ) | const [inline] |
Definition at line 420 of file Hash_Map_Manager_T.inl.
00421 { 00422 return const_reverse_iterator (*this); 00423 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rbegin | ( | void | ) | [inline] |
Return reverse iterator.
Definition at line 406 of file Hash_Map_Manager_T.inl.
00407 { 00408 return reverse_iterator (*this); 00409 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| EXT_ID & | old_ext_id, | |||
| INT_ID & | old_int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline] |
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 365 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| EXT_ID & | old_ext_id, | |||
| INT_ID & | old_int_id | |||
| ) | [inline] |
Associate ext_id with int_id. If ext_id is not in the map then behaves just like <bind>. Otherwise, store the old values of ext_id and int_id 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_Map_Entrys 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 354 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| INT_ID & | old_int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline] |
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 343 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| INT_ID & | old_int_id | |||
| ) | [inline] |
Associate ext_id with int_id. If ext_id is not in the map then behaves just like <bind>. Otherwise, store the old value of int_id 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 333 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline] |
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 323 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id | |||
| ) | [inline] |
Reassociate ext_id with int_id. 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 314 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| EXT_ID & | old_ext_id, | |||
| INT_ID & | old_int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 373 of file Hash_Map_Manager_T.cpp.
00378 { 00379 size_t dummy = 0; 00380 if (this->shared_find (ext_id, entry, dummy) == -1) 00381 return this->bind_i (ext_id, int_id); 00382 else 00383 { 00384 old_ext_id = entry->ext_id_; 00385 old_int_id = entry->int_id_; 00386 entry->ext_id_ = ext_id; 00387 entry->int_id_ = int_id; 00388 return 1; 00389 } 00390 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| EXT_ID & | old_ext_id, | |||
| INT_ID & | old_int_id | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 299 of file Hash_Map_Manager_T.inl.
00303 { 00304 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; 00305 00306 return this->rebind_i (ext_id, 00307 int_id, 00308 old_ext_id, 00309 old_int_id, 00310 node); 00311 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| INT_ID & | old_int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 355 of file Hash_Map_Manager_T.cpp.
00359 { 00360 size_t dummy = 0; 00361 if (this->shared_find (ext_id, entry, dummy) == -1) 00362 return this->bind_i (ext_id, int_id); 00363 else 00364 { 00365 old_int_id = entry->int_id_; 00366 entry->ext_id_ = ext_id; 00367 entry->int_id_ = int_id; 00368 return 1; 00369 } 00370 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| INT_ID & | old_int_id | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 286 of file Hash_Map_Manager_T.inl.
00289 { 00290 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; 00291 00292 return this->rebind_i (ext_id, 00293 int_id, 00294 old_int_id, 00295 node); 00296 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 339 of file Hash_Map_Manager_T.cpp.
00342 { 00343 size_t dummy = 0; 00344 if (this->shared_find (ext_id, entry, dummy) == -1) 00345 return this->bind_i (ext_id, int_id); 00346 else 00347 { 00348 entry->ext_id_ = ext_id; 00349 entry->int_id_ = int_id; 00350 return 1; 00351 } 00352 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i | ( | const EXT_ID & | ext_id, | |
| const INT_ID & | int_id | |||
| ) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 275 of file Hash_Map_Manager_T.inl.
00277 { 00278 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; 00279 00280 return this->rebind_i (ext_id, 00281 int_id, 00282 node); 00283 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rend | ( | void | ) | const [inline] |
Definition at line 427 of file Hash_Map_Manager_T.inl.
00428 { 00429 return const_reverse_iterator (*this, 1); 00430 }
| ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rend | ( | void | ) | [inline] |
Definition at line 413 of file Hash_Map_Manager_T.inl.
00414 { 00415 return reverse_iterator (*this, 1); 00416 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find | ( | const EXT_ID & | ext_id, | |
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry, | |||
| size_t & | loc | |||
| ) | [inline, protected] |
Returns the ACE_Hash_Map_Entry that corresponds to ext_id.
Definition at line 309 of file Hash_Map_Manager_T.cpp.
00312 { 00313 if (this->total_size_ == 0) 00314 { 00315 errno = ENOENT; 00316 return -1; 00317 } 00318 00319 loc = this->hash (ext_id) % this->total_size_; 00320 00321 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_; 00322 00323 while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) 00324 temp = temp->next_; 00325 00326 if (temp == &this->table_[loc]) 00327 { 00328 errno = ENOENT; 00329 return -1; 00330 } 00331 else 00332 { 00333 entry = temp; 00334 return 0; 00335 } 00336 }
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > * ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table | ( | void | ) | [inline, protected] |
Accessor of the underlying table.
Definition at line 434 of file Hash_Map_Manager_T.inl.
00435 { 00436 return this->table_; 00437 }
| size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size | ( | void | ) | const [inline] |
Return the size of the array that's used to point to the linked lists of ACE_Hash_Map_Entry objects in the hash table.
Definition at line 66 of file Hash_Map_Manager_T.inl.
00067 { 00068 return this->total_size_; 00069 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline] |
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 141 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | [inline] |
Associate ext_id with int_id if and only if ext_id is not in the map. If ext_id is already in the map then the int_id 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 132 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id, | |||
| ACE_Hash_Map_Entry< EXT_ID, INT_ID > *& | entry | |||
| ) | [inline, protected] |
Performs trybind. Must be called with locks held.
Definition at line 250 of file Hash_Map_Manager_T.cpp.
00253 { 00254 size_t loc = 0; 00255 if (this->shared_find (ext_id, entry, loc) == -1) 00256 { 00257 // Not found. 00258 void *ptr = 0; 00259 ACE_ALLOCATOR_RETURN (ptr, 00260 this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), 00261 -1); 00262 00263 entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, 00264 int_id, 00265 this->table_[loc].next_, 00266 &this->table_[loc]); 00267 this->table_[loc].next_ = entry; 00268 entry->next_->prev_ = entry; 00269 ++this->cur_size_; 00270 return 0; 00271 } 00272 else 00273 return 1; 00274 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | [inline, protected] |
Performs trybind. Must be called with locks held.
Definition at line 120 of file Hash_Map_Manager_T.inl.
00122 { 00123 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; 00124 00125 int result = this->trybind_i (ext_id, int_id, temp); 00126 if (result == 1) 00127 int_id = temp->int_id_; 00128 return result; 00129 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | typename ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator | pos | ) | [inline] |
Remove entry from map pointed to by iterator pos.
This unbind operation is fast relative to those that accept an external ID parameter since no map lookup is performed.
Definition at line 177 of file Hash_Map_Manager_T.inl.
00183 { 00184 return this->unbind (&(*pos)); 00185 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | ACE_Hash_Map_Entry< EXT_ID, INT_ID > * | entry | ) | [inline] |
Remove entry from map.
This unbind operation is fast relative to those that accept an external ID parameter since no map lookup is performed.
Definition at line 196 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | [inline] |
Break any association of ext_id. Returns the value of int_id in case the caller needs to deallocate memory. Return 0 if the unbind was successful, and returns -1 if failures occur.
Definition at line 159 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind | ( | const EXT_ID & | ext_id | ) | [inline] |
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 188 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all | ( | void | ) | [inline] |
Removes all the entries in the ACE_Hash_Map_Manager_Ex.
Definition at line 46 of file Hash_Map_Manager_T.inl.
00047 { 00048 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); 00049 00050 return this->unbind_all_i (); 00051 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i | ( | void | ) | [inline, protected] |
Removes all the entries in <Map_Manager_Ex>. Must be called with locks held.
Definition at line 194 of file Hash_Map_Manager_T.cpp.
00195 { 00196 // Iterate through the entire map calling the destuctor of each 00197 // <ACE_Hash_Map_Entry>. 00198 for (size_t i = 0; i < this->total_size_; i++) 00199 { 00200 for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; 00201 temp_ptr != &this->table_[i]; 00202 ) 00203 { 00204 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr; 00205 temp_ptr = temp_ptr->next_; 00206 00207 // Explicitly call the destructor. 00208 ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free, 00209 ACE_Hash_Map_Entry, EXT_ID, INT_ID); 00210 } 00211 00212 // Restore the sentinel. 00213 this->table_[i].next_ = &this->table_[i]; 00214 this->table_[i].prev_ = &this->table_[i]; 00215 } 00216 00217 this->cur_size_ = 0; 00218 00219 return 0; 00220 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | ACE_Hash_Map_Entry< EXT_ID, INT_ID > * | entry | ) | [inline, protected] |
Performs unbind. Must be called with locks held.
Definition at line 295 of file Hash_Map_Manager_T.cpp.
00296 { 00297 entry->next_->prev_ = entry->prev_; 00298 entry->prev_->next_ = entry->next_; 00299 00300 // Explicitly call the destructor. 00301 ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free, 00302 ACE_Hash_Map_Entry, EXT_ID, INT_ID); 00303 00304 --this->cur_size_; 00305 return 0; 00306 }
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | const EXT_ID & | ext_id | ) | [inline, protected] |
Performs unbind. Must be called with locks held.
Definition at line 151 of file Hash_Map_Manager_T.inl.
| int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i | ( | const EXT_ID & | ext_id, | |
| INT_ID & | int_id | |||
| ) | [inline, protected] |
Performs unbind. Must be called with locks held.
Definition at line 277 of file Hash_Map_Manager_T.cpp.
00279 { 00280 ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; 00281 00282 size_t loc = 0; 00283 if (this->shared_find (ext_id, temp, loc) == -1) 00284 { 00285 errno = ENOENT; 00286 return -1; 00287 } 00288 00289 int_id = temp->int_id_; 00290 00291 return this->unbind_i (temp); 00292 }
friend class ACE_Hash_Map_Bucket_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 138 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 134 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Const_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 135 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Const_Reverse_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 137 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 132 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 133 of file Hash_Map_Manager_T.h.
friend class ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend] |
Definition at line 136 of file Hash_Map_Manager_T.h.
ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::COMPARE_KEYS [private] |
Definition at line 580 of file Hash_Map_Manager_T.h.
COMPARE_KEYS ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::compare_keys_ [protected] |
Function object used for comparing keys.
Definition at line 551 of file Hash_Map_Manager_T.h.
size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size_ [private] |
Current number of entries in the table
Definition at line 576 of file Hash_Map_Manager_T.h.
ACE_Allocator* ACE_Hash_Map_Manager_Ex< 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_Map_Entry<EXT_ID, INT_ID>) bytes each.
Definition at line 541 of file Hash_Map_Manager_T.h.
ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::HASH_KEY [private] |
Definition at line 580 of file Hash_Map_Manager_T.h.
HASH_KEY ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash_key_ [protected] |
Function object used for hashing keys.
Definition at line 548 of file Hash_Map_Manager_T.h.
ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::INT_ID [private] |
Definition at line 580 of file Hash_Map_Manager_T.h.
ACE_LOCK ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_ [mutable, protected] |
Synchronization variable for the MT_SAFE ACE_Hash_Map_Manager_Ex.
Definition at line 545 of file Hash_Map_Manager_T.h.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_ [private] |
Array of ACE_Hash_Map_Entry *s, each of which points to an ACE_Hash_Map_Entry that serves as the beginning of a linked list of <EXT_ID>s that hash to that bucket.
Definition at line 568 of file Hash_Map_Manager_T.h.
ACE_Allocator* ACE_Hash_Map_Manager_Ex< 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_Map_Entry<EXT_ID, INT_ID>),
Definition at line 536 of file Hash_Map_Manager_T.h.
size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size_ [private] |
Total size of the hash table.
Definition at line 571 of file Hash_Map_Manager_T.h.
1.6.1