Define a multi-map abstraction that efficiently associates the keys with their different values. More...
#include <Hash_Multi_Map_Manager_T.h>
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 > |
Define a multi-map abstraction that efficiently associates the keys with their different values.
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 161 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_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 159 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 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_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 | |||
) | [inline] |
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.
: table_allocator_ (table_alloc), entry_allocator_ (entry_alloc), table_ (0), total_size_ (0), cur_size_ (0) { if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); }
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 | |||
) | [inline] |
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.
: table_allocator_ (table_alloc), entry_allocator_ (entry_alloc), table_ (0), total_size_ (0), cur_size_ (0) { if (this->open (size, table_alloc, entry_alloc) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); }
ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Multi_Map_Manager | ( | void | ) | [inline] |
Cleanup the Hash_Multi_Map_Manager.
Definition at line 53 of file Hash_Multi_Map_Manager_T.inl.
{ this->close (); }
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_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 | ) | [inline] |
Return forward iterator.
Definition at line 425 of file Hash_Multi_Map_Manager_T.inl.
{ return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); }
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 | |||
) | [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 118 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id, entry); }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id); }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id_set); }
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 | |||
) | [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 137 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id_set, entry); }
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 | |||
) | [inline, protected] |
Performs bind. Must be called with locks held.
Definition at line 91 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; return this->bind_i (ext_id, int_id, temp); }
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.
{ size_t loc; int result = this->shared_find (ext_id, entry, loc); ACE_Unbounded_Set<INT_ID> int_id_set; if (result == -1) { void *ptr; // Not found. ACE_ALLOCATOR_RETURN (ptr, this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), -1); int_id_set.insert (int_id); entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, int_id_set, this->table_[loc].next_, &this->table_[loc]); this->table_[loc].next_ = entry; entry->next_->prev_ = entry; this->cur_size_++; return 0; } else { int_id_set = (*entry).int_id_set_; if (0 == int_id_set.insert (int_id)) { this->unbind_i (entry); return this->bind_i (ext_id, int_id_set); } else return 1; } }
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 | |||
) | [inline, protected] |
Performs bind. Must be called with locks held.
Definition at line 100 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; return this->bind_i (ext_id, int_id_set, temp); }
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.
{ size_t loc; int result = this->shared_find (ext_id, entry, loc); if (result == -1) { void *ptr; // Not found. ACE_ALLOCATOR_RETURN (ptr, this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), -1); entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, int_id_set, this->table_[loc].next_, &this->table_[loc]); this->table_[loc].next_ = entry; entry->next_->prev_ = entry; this->cur_size_++; return 0; } else return 1; }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close | ( | void | ) | [inline] |
Close down a Hash_Multi_Map_Manager and release dynamically allocated resources.
Definition at line 37 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->close_i (); }
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.
{ // Protect against "double-deletion" in case the destructor also // gets called. if (this->table_ != 0) { // Remove all the entries. this->unbind_all_i (); // Iterate through the buckets cleaning up the sentinels. for (size_t i = 0; i < this->total_size_; i++) { // Destroy the dummy entry. ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i]; // The second argument results in a no-op instead of // deallocation. ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); } // Reset size. this->total_size_ = 0; // Free table memory. this->table_allocator_->free (this->table_); // Should be done last... this->table_ = 0; } return 0; }
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.
{ size_t bytes = size * sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>); void *ptr; ACE_ALLOCATOR_RETURN (ptr, this->table_allocator_->malloc (bytes), -1); this->table_ = (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *) ptr; this->total_size_ = size; // Initialize each entry in the hash table to be a circular linked // list with the dummy node in the front serving as the anchor of // the list. for (size_t i = 0; i < size; i++) new (&this->table_[i]) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], &this->table_[i]); return 0; }
size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size | ( | void | ) | const [inline, protected] |
Accessor of the current size attribute.
Definition at line 460 of file Hash_Multi_Map_Manager_T.inl.
{ return this->cur_size_; }
size_t ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size | ( | void | ) | const [inline] |
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.
{ return this->cur_size_; }
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.
{ #if defined (ACE_HAS_DUMP) ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d"), this->total_size_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_)); this->table_allocator_->dump (); this->entry_allocator_->dump (); this->lock_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ }
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 | ) | [inline] |
Definition at line 432 of file Hash_Multi_Map_Manager_T.inl.
{ return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); }
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 | |||
) | [inline, 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.
{ return this->compare_keys_ (id1, id2); }
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 [inline] |
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.
{ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> (this); ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); return nc_this->find_i (ext_id, int_id); }
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 [inline] |
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.
{ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> (this); ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); return nc_this->find_i (ext_id, int_id_set); }
int ACE_Hash_Multi_Map_Manager< 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 289 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> (this); ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); return nc_this->find_i (ext_id); }
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 [inline] |
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.
{ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *> (this); ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); return nc_this->find_i (ext_id, entry); }
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 | |||
) | [inline, 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.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return -1; else { int_id_set = entry->int_id_set_; return 0; } }
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 | |||
) | [inline, 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.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return -1; else { if (0 == entry->int_id_set_.find (int_id)) return 0; else return -1; } }
int ACE_Hash_Multi_Map_Manager< 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 254 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry; size_t dummy; return this->shared_find (ext_id, entry, dummy); }
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 | |||
) | [inline, 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.
{ size_t dummy; return this->shared_find (ext_id, entry, dummy); }
u_long ACE_Hash_Multi_Map_Manager< 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.
Definition at line 78 of file Hash_Multi_Map_Manager_T.inl.
{ return this->hash_key_ (ext_id); }
ACE_LOCK & ACE_Hash_Multi_Map_Manager< 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 71 of file Hash_Multi_Map_Manager_T.inl.
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); // Calling this->close_i () to ensure we release previous allocated // memory before allocating new one. this->close_i (); if (table_alloc == 0) table_alloc = ACE_Allocator::instance (); this->table_allocator_ = table_alloc; if (entry_alloc == 0) entry_alloc = table_alloc; this->entry_allocator_ = entry_alloc; // This assertion is here to help track a situation that shouldn't // happen, but did with Sun C++ 4.1 (before a change to this class // was made: it used to have an enum that was supposed to be defined // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). if (size == 0) return -1; return this->create_buckets (size); }
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_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 | ) | [inline] |
Return reverse iterator.
Definition at line 439 of file Hash_Multi_Map_Manager_T.inl.
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 | |||
) | [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 412 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set, entry); }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set); }
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 | |||
) | [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 370 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set, entry); }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set, old_int_id_set); }
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 | |||
) | [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 390 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set, old_int_id_set, entry); }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set); }
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.
{ size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id_set); else { old_ext_id = entry->ext_id_; old_int_id_set = entry->int_id_set_; entry->ext_id_ = ext_id; entry->int_id_set_ = int_id_set; return 1; } }
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.
{ size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id_set); else { old_int_id_set = entry->int_id_set_; entry->ext_id_ = ext_id; entry->int_id_set_ = int_id_set; return 1; } }
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.
{ size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id_set); else { entry->ext_id_ = ext_id; entry->int_id_set_ = int_id_set; return 1; } }
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 | |||
) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 322 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; return this->rebind_i (ext_id, int_id_set, node); }
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 | |||
) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 333 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; return this->rebind_i (ext_id, int_id_set, old_int_id_set, node); }
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 | |||
) | [inline, protected] |
Performs rebind. Must be called with locks held.
Definition at line 346 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node; return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set, node); }
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 | ) | [inline] |
Definition at line 446 of file Hash_Multi_Map_Manager_T.inl.
{ return ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); }
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.
{ loc = this->hash (ext_id) % this->total_size_; ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_; while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) temp = temp->next_; if (temp == &this->table_[loc]) { errno = ENOENT; return -1; } else { entry = temp; return 0; } }
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 | ) | [inline, protected] |
Accessor of the underlying table.
Definition at line 453 of file Hash_Multi_Map_Manager_T.inl.
{ return this->table_; }
size_t ACE_Hash_Multi_Map_Manager< 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_Multi_Map_Entry
objects in the hash table.
Definition at line 65 of file Hash_Multi_Map_Manager_T.inl.
{ return this->total_size_; }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->trybind_i (ext_id, int_id_set); }
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 | |||
) | [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 168 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->trybind_i (ext_id, int_id_set, entry); }
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.
{ size_t loc; int result = this->shared_find (ext_id, entry, loc); if (result == -1) { // Not found. void *ptr; ACE_ALLOCATOR_RETURN (ptr, this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)), -1); entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id, int_id_set, this->table_[loc].next_, &this->table_[loc]); this->table_[loc].next_ = entry; entry->next_->prev_ = entry; this->cur_size_++; return 0; } else return 1; }
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 | |||
) | [inline, protected] |
Performs trybind. Must be called with locks held.
Definition at line 147 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; int result = this->trybind_i (ext_id, int_id_set, temp); if (result == 1) int_id_set = temp->int_id_set_; return result; }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id, int_id); }
int ACE_Hash_Multi_Map_Manager< 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 204 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id) == -1 ? -1 : 0; }
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 | |||
) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id, int_id_set); }
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 | ) | [inline] |
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.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (entry) == -1 ? -1 : 0; }
int ACE_Hash_Multi_Map_Manager< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all | ( | void | ) | [inline] |
Removes all the entries in Hash_Multi_Map_Manager.
Definition at line 45 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_all_i (); }
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.
{ // Iterate through the entire map calling the destuctor of each // <ACE_Hash_Multi_Map_Entry>. for (size_t i = 0; i < this->total_size_; i++) { for (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; temp_ptr != &this->table_[i]; ) { ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr; temp_ptr = temp_ptr->next_; // Explicitly call the destructor. ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free, ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); } // Restore the sentinel. this->table_[i].next_ = &this->table_[i]; this->table_[i].prev_ = &this->table_[i]; } this->cur_size_ = 0; return 0; }
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.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; size_t loc; int result = this->shared_find (ext_id, temp, loc); if (result == -1) { errno = ENOENT; return -1; } int_id_set = temp->int_id_set_; return this->unbind_i (temp); }
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.
{ entry->next_->prev_ = entry->prev_; entry->prev_->next_ = entry->next_; // Explicitly call the destructor. ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free, ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); this->cur_size_--; return 0; }
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.
{ ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; size_t loc; int result = this->shared_find (ext_id, temp, loc); if (result == -1) { errno = ENOENT; return -1; } ACE_Unbounded_Set<INT_ID> int_id_set = (*temp).int_id_set_; if (0 == int_id_set.remove (int_id)) { this->unbind_i (temp); if (0 != int_id_set.size ()) return this->bind_i (ext_id, int_id_set); else return 0; } else return -1; }
int ACE_Hash_Multi_Map_Manager< 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 178 of file Hash_Multi_Map_Manager_T.inl.
{ ACE_Unbounded_Set<INT_ID> int_id_set; return this->unbind_i (ext_id, int_id_set); }
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.
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.
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.
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.
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.
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.
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.
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.