diff options
author | storri <storri@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-05-28 17:21:44 +0000 |
---|---|---|
committer | storri <storri@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-05-28 17:21:44 +0000 |
commit | f35da05bce56147c3be426fc4c0b106889a586c6 (patch) | |
tree | 3f6d7bf06315b5e6422e89d8baf1c2aeae220c07 | |
parent | 56f660cf36b2830d44dddfbd9702ac343ab39733 (diff) | |
download | ATCD-f35da05bce56147c3be426fc4c0b106889a586c6.tar.gz |
Adding reverse_const_iterators to the ACE_Hash_Map_Manager_Ex class.
-rw-r--r-- | ace/Hash_Map_Manager_T.cpp | 435 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.h | 700 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.i | 2191 | ||||
-rw-r--r-- | tests/Hash_Map_Manager_Test.cpp | 84 |
4 files changed, 2743 insertions, 667 deletions
diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp index df38488f3e9..716974cb63b 100644 --- a/ace/Hash_Map_Manager_T.cpp +++ b/ace/Hash_Map_Manager_T.cpp @@ -40,19 +40,25 @@ ACE_RCSID(ace, Hash_Map_Manager_T, "$Id$") -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) +template <class EXT_ID, + class INT_ID> +ACE_Hash_Map_Entry<EXT_ID, + INT_ID>::ACE_Hash_Map_Entry +(ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) : next_ (next), prev_ (prev) { } -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) +template <class EXT_ID, + class INT_ID> +ACE_Hash_Map_Entry<EXT_ID, + INT_ID>::ACE_Hash_Map_Entry +(const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) : ext_id_ (ext_id), int_id_ (int_id), next_ (next), @@ -61,8 +67,9 @@ ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (const EXT_ID &ext_id, } # if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::~ACE_Hash_Map_Entry (void) +template <class EXT_ID, + class INT_ID> +ACE_Hash_Map_Entry<EXT_ID,INT_ID>::~ACE_Hash_Map_Entry (void) { } # endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ @@ -91,8 +98,17 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump #endif /* ACE_HAS_DUMP */ } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::create_buckets (size_t size) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::create_buckets (size_t size) { size_t bytes = size * sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>); void *ptr; @@ -109,14 +125,26 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::creat // 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_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], - &this->table_[i]); + { + new (&this->table_[i]) + ACE_Hash_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], + &this->table_[i]); + } return 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open (size_t size, - ACE_Allocator *alloc) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::open (size_t size, + ACE_Allocator *alloc) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); @@ -125,7 +153,9 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open this->close_i (); if (alloc == 0) - alloc = ACE_Allocator::instance (); + { + alloc = ACE_Allocator::instance (); + } this->allocator_ = alloc; @@ -138,8 +168,17 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open return this->create_buckets (size); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::close_i (void) { // Protect against "double-deletion" in case the destructor also // gets called. @@ -153,6 +192,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close { // Destroy the dummy entry. ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i]; + // The "if" second argument results in a no-op instead of // deallocation. ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, @@ -172,14 +212,24 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close return 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::unbind_all_i (void) { // Iterate through the entire map calling the destuctor of each // <ACE_Hash_Map_Entry>. for (size_t i = 0; i < this->total_size_; i++) { - for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; + for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = + this->table_[i].next_; temp_ptr != &this->table_[i]; ) { @@ -201,10 +251,20 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbin return 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { size_t loc; int result = this->shared_find (ext_id, entry, loc); @@ -214,26 +274,41 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_ void *ptr; // Not found. ACE_ALLOCATOR_RETURN (ptr, - this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), + this->allocator_->malloc + (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), -1); - entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); + entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> + (ext_id, + int_id, + this->table_[loc].next_, + &this->table_[loc]); + this->table_[loc].next_ = entry; entry->next_->prev_ = entry; this->cur_size_++; return 0; } else - return 1; + { + return 1; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { size_t loc; int result = this->shared_find (ext_id, entry, loc); @@ -243,25 +318,39 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybi // Not found. void *ptr; ACE_ALLOCATOR_RETURN (ptr, - this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), + this->allocator_->malloc + (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), -1); - entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); + entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> + (ext_id, + int_id, + this->table_[loc].next_, + &this->table_[loc]); + this->table_[loc].next_ = entry; entry->next_->prev_ = entry; this->cur_size_++; return 0; } else - return 1; + { + return 1; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; @@ -279,8 +368,18 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbin return this->unbind_i (temp); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { entry->next_->prev_ = entry->prev_; entry->prev_->next_ = entry->next_; @@ -292,17 +391,30 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbin return 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { loc = this->hash (ext_id) % this->total_size_; ACE_Hash_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_; + while (temp != &this->table_[loc] && this->equal + (temp->ext_id_, ext_id) == 0) + { + temp = temp->next_; + } if (temp == &this->table_[loc]) { @@ -316,14 +428,26 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::share } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); + { + return this->bind_i (ext_id, int_id); + } else { entry->ext_id_ = ext_id; @@ -332,15 +456,28 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { size_t dummy; + if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); + { + return this->bind_i (ext_id, int_id); + } else { old_int_id = entry->int_id_; @@ -350,16 +487,29 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +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) { size_t dummy; + if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); + { + return this->bind_i (ext_id, int_id); + } else { old_ext_id = entry->ext_id_; @@ -374,34 +524,58 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Base_Ex) -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +void +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump_i (void) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("index_ = %d "), this->index_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next_ = %x"), this->next_)); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::forward_i (void) { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i"); if (this->map_man_->table_ == 0) - return -1; + { + return -1; + } // Handle initial case specially. else if (this->index_ == -1) { this->index_++; return this->forward_i (); } - else if (this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_)) - return 0; + else if (this->index_ >= ACE_static_cast (ssize_t, + this->map_man_->total_size_)) + { + return 0; + } this->next_ = this->next_->next_; + if (this->next_ == &this->map_man_->table_[this->index_]) { while (++this->index_ < ACE_static_cast (ssize_t, @@ -409,27 +583,43 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: { this->next_ = this->map_man_->table_[this->index_].next_; if (this->next_ != &this->map_man_->table_[this->index_]) - break; + { + break; + } } } return this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::reverse_i (void) { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i"); if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == ACE_static_cast (ssize_t, this->map_man_->total_size_)) + { + return -1; + } + else if (this->index_ == ACE_static_cast (ssize_t, + this->map_man_->total_size_)) { this->index_--; return this->reverse_i (); } else if (this->index_ < 0) - return 0; + { + return 0; + } this->next_ = this->next_->prev_; if (this->next_ == &this->map_man_->table_[this->index_]) @@ -438,7 +628,9 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: { this->next_ = this->map_man_->table_[this->index_].prev_; if (this->next_ != &this->map_man_->table_[this->index_]) - break; + { + break; + } } } @@ -449,24 +641,44 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Base_Ex) -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +void +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump_i (void) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("index_ = %d "), this->index_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next_ = %x"), this->next_)); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::forward_i (void) { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i"); if (this->map_man_->table_ == 0) - return -1; + { + return -1; + } // Handle initial case specially. else if (this->index_ == -1) { @@ -474,7 +686,9 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ return this->forward_i (); } else if (this->index_ >= (ssize_t) this->map_man_->total_size_) - return 0; + { + return 0; + } this->next_ = this->next_->next_; if (this->next_ == &this->map_man_->table_[this->index_]) @@ -483,27 +697,42 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ { this->next_ = this->map_man_->table_[this->index_].next_; if (this->next_ != &this->map_man_->table_[this->index_]) - break; + { + break; + } } } return this->index_ < (ssize_t) this->map_man_->total_size_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::reverse_i (void) { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i"); if (this->map_man_->table_ == 0) - return -1; + { + return -1; + } else if (this->index_ == (ssize_t) this->map_man_->total_size_) { this->index_--; return this->reverse_i (); } else if (this->index_ < 0) - return 0; + { + return 0; + } this->next_ = this->next_->prev_; if (this->next_ == &this->map_man_->table_[this->index_]) @@ -512,7 +741,9 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ { this->next_ = this->map_man_->table_[this->index_].prev_; if (this->next_ != &this->map_man_->table_[this->index_]) - break; + { + break; + } } } diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index 4b579261feb..decf19b0209 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -66,27 +66,58 @@ public: }; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Iterator_Base_Ex; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Const_Iterator_Base_Ex; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Iterator_Ex; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Const_Iterator_Ex; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Reverse_Iterator_Ex; // Forward decl. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +class ACE_Hash_Map_Reverse_Const_Iterator_Ex; + +// Forward decl. +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Bucket_Iterator; // Forward decl. @@ -105,39 +136,119 @@ class ACE_Allocator; * user can make this a persistent class by providing an * <ACE_Allocator> with a persistable memory pool. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Manager_Ex { public: - friend class ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - friend class ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - friend class ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - friend class ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - friend class ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - friend class ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; - - typedef EXT_ID - KEY; - typedef INT_ID - VALUE; - typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> - ENTRY; + + friend class ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + friend class ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>; + + typedef EXT_ID KEY; + + typedef INT_ID VALUE; + typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ENTRY; // = ACE-style iterator typedefs. - 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_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_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> + REVERSE_CONST_ITERATOR; // = STL-style iterator typedefs. - 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_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_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> + reverse_const_iterator; // = Initialization and termination methods. @@ -148,12 +259,18 @@ public: ACE_Hash_Map_Manager_Ex (size_t size, ACE_Allocator *alloc = 0); + ACE_Hash_Map_Manager_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &); + /// Initialize a <Hash_Map_Manager_Ex> with <size> elements. int open (size_t size = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = 0); - /// Close down a <Hash_Map_Manager_Ex> and release dynamically allocated - /// resources. + /// Close down a <Hash_Map_Manager_Ex> and release dynamically + /// allocated resources. int close (void); /// Removes all the entries in <Map_Manager_Ex>. @@ -284,9 +401,10 @@ public: */ int unbind (const EXT_ID &ext_id); - /// 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 successfully, and returns -1 if failures occur. + /// 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 successfully, and returns -1 if failures + /// occur. int unbind (const EXT_ID &ext_id, INT_ID &int_id); @@ -318,14 +436,59 @@ public: // = STL styled iterator factory functions. /// Return forward iterator. - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> begin (void); - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> end (void); + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> begin (void); + + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> end (void); + + /// Read-only forward iterator + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> begin (void) const; + + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> end (void) const; /// Return reverse iterator. - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rbegin (void); - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rend (void); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> rbegin (void); + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> rend (void); + + /// Read-only forward iterator + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> rbegin (void) const; + + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> rend (void) const; protected: + // = The following methods do the actual work. /// Returns 1 if <id1> == <id2>, else 0. This is defined as a @@ -440,13 +603,13 @@ protected: /// Function object used for comparing keys. COMPARE_KEYS compare_keys_; -protected: /// Returns the <ACE_Hash_Map_Entry> that corresponds to <ext_id>. int shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, size_t &loc); 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 @@ -462,8 +625,9 @@ private: size_t cur_size_; // = Disallow these operations. - 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, 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> &)) }; /** @@ -474,14 +638,22 @@ private: * This class factors out common code from its templatized * subclasses. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Iterator_Base_Ex { public: + // = Initialization method. - /// Contructor. If head != 0, the iterator constructed is positioned - /// at the head of the map, it is positioned at the end otherwise. - ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + + /// Contructor. If head != 0, the iterator constructed is + /// positioned at the head of the map, it is positioned at the end + /// otherwise. + ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int head); // = ITERATION methods. @@ -498,16 +670,24 @@ public: /// Returns reference the Hash_Map_Manager_Ex that is being iterated /// over. - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void); + ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>& map (void); /// Check if two iterators point to the same position - int operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; - int operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + int operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + + int operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; protected: + /// Move forward by one element in the set. Returns 0 when there's /// no more item in the set after the current items, else 1. int forward_i (void); @@ -520,7 +700,11 @@ protected: void dump_i (void) const; /// Map we are iterating over. - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_; + ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> *map_man_; /// Keeps track of how far we've advanced in the table. ssize_t index_; @@ -538,14 +722,23 @@ protected: * This class factors out common code from its templatized * subclasses. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Const_Iterator_Base_Ex { public: + // = Initialization method. - /// Contructor. If head != 0, the iterator constructed is positioned - /// at the head of the map, it is positioned at the end otherwise. - ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + + /// Contructor. If head != 0, the iterator constructed is + /// positioned at the head of the map, it is positioned at the end + /// otherwise. + ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> &mm, int head); // = ITERATION methods. @@ -562,11 +755,18 @@ public: /// Returns reference the Hash_Map_Manager_Ex that is being iterated /// over. - const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void); + const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>& map (void); /// Check if two iterators point to the same position - int operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; - int operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + int operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + + int operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -584,7 +784,11 @@ protected: void dump_i (void) const; /// Map we are iterating over. - const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_; + const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> *map_man_; /// Keeps track of how far we've advanced in the table. ssize_t index_; @@ -606,15 +810,27 @@ protected: * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> -class ACE_Hash_Map_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +class ACE_Hash_Map_Iterator_Ex + : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> { public: + // = Initialization method. - ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int tail = 0); // = Iteration methods. + /// Move forward by one element in the set. Returns 0 when all the /// items in the set have been seen, else 1. int advance (void); @@ -625,16 +841,32 @@ public: // = STL styled iteration, compare, and reference functions. /// Prefix advance. - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator++ (void); /// Postfix advance. - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator++ (int); /// Prefix reverse. - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator-- (void); /// Postfix reverse. - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator-- (int); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -652,12 +884,23 @@ public: * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> -class ACE_Hash_Map_Const_Iterator_Ex : public ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +class ACE_Hash_Map_Const_Iterator_Ex + : public ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> { public: // = Initialization method. - ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> &mm, int tail = 0); // = Iteration methods. @@ -671,16 +914,32 @@ public: // = STL styled iteration, compare, and reference functions. /// Prefix advance. - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator++ (void); /// Postfix advance. - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator++ (int); /// Prefix reverse. - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator-- (void); /// Postfix reverse. - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator-- (int); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -705,39 +964,67 @@ public: * instantiations for bucket iterators on platforms with broken * templates. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> class ACE_Hash_Map_Bucket_Iterator { public: // = Initialization method. - ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, const EXT_ID &ext_id, int tail = 0); // = STL styled iteration, compare, and reference functions. /// Prefix advance. - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator++ (void); /// Postfix advance. - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator++ (int); /// Prefix reverse. - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator-- (void); /// Postfix reverse. - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator-- (int); /// Returns a reference to the interal element <this> is pointing to. ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void) const; /// Returns reference the Hash_Map_Manager_Ex that is being iterated /// over. - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void); + ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>& map (void); /// Check if two iterators point to the same position - int operator== (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; - int operator!= (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + int operator== (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + + int operator!= (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; protected: /// Move forward by one element in the set. Returns 0 when there's @@ -749,7 +1036,11 @@ protected: int reverse_i (void); /// Map we are iterating over. - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_; + ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> *map_man_; /// Keeps track of how far we've advanced in the table. ssize_t index_; @@ -771,12 +1062,23 @@ protected: * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> -class ACE_Hash_Map_Reverse_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +class ACE_Hash_Map_Reverse_Iterator_Ex + : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> { public: + // = Initialization method. - ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int head = 0); // = Iteration methods. @@ -790,16 +1092,105 @@ public: // = STL styled iteration, compare, and reference functions. /// Prefix reverse. - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator++ (void); /// Postfix reverse. - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator++ (int); /// Prefix advance. - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator-- (void); /// Postfix advance. - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator-- (int); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/** + * @class ACE_Hash_Map_Reverse_Const_Iterator_Ex + * + * @brief Const reverse iterator for the <ACE_Hash_Map_Manager_Ex>. + * + * This class does not perform any internal locking of the + * <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is + * inherently inefficient and/or error-prone within an STL-style + * iterator. If you require locking, you can explicitly use an + * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + * internal lock, which is accessible via its <mutex> method. + */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +class ACE_Hash_Map_Reverse_Const_Iterator_Ex + : public ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> +{ +public: + // = Initialization method. + ACE_Hash_Map_Reverse_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> &mm, + int head = 0); + + // = Iteration methods. + /// Move back by one element in the set towards the beginning. + /// Returns 0 when all the items in the set have been seen, else 1. + int advance (void); + + /// Dump the state of an object. + void dump (void) const; + + // = STL styled iteration, compare, and reference functions. + + /// Prefix advance. + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator++ (void); + + /// Postfix advance. + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator++ (int); + + /// Prefix reverse. + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> &operator-- (void); + + /// Postfix reverse. + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> operator-- (int); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -845,8 +1236,15 @@ public: * -# operator= * -# operator< */ -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Manager : public ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +class ACE_Hash_Map_Manager + : public ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> { public: /// Initialize a <Hash_Map_Manager> with default size. @@ -858,7 +1256,9 @@ public: // = The following two are necessary for template specialization of // ACE_Hash_Map_Manager to work. - int equal (const EXT_ID &id1, const EXT_ID &id2); + int equal (const EXT_ID &id1, + const EXT_ID &id2); + u_long hash (const EXT_ID &ext_id); }; @@ -867,21 +1267,37 @@ public: * * @brief Wrapper for backward compatibility. */ -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Iterator : public ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +class ACE_Hash_Map_Iterator + : public ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> { public: + // = Initialization method. /// Construct from map - ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, + INT_ID, + ACE_LOCK> &mm, int tail = 0); /// Construct from base - ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); /// Assignment from base ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> & - operator= (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + operator= (const ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); }; /** @@ -889,21 +1305,36 @@ public: * * @brief Wrapper for backward compatibility. */ -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Const_Iterator : public ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +class ACE_Hash_Map_Const_Iterator + : public ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> { public: + // = Initialization method. /// Construct from map - ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager<EXT_ID, INT_ID, + ACE_LOCK> &mm, int tail = 0); /// Construct from base - ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); /// Assignment from base ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> & - operator= (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + operator= (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); }; /** @@ -911,20 +1342,71 @@ public: * * @brief Wrapper for backward compatibility. */ -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Reverse_Iterator : public ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +class ACE_Hash_Map_Reverse_Iterator + : public ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> { public: // = Initialization method. - ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, + INT_ID, ACE_LOCK> &mm, int head = 0); /// Construct from base - ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); /// Assignment from base ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> & - operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); +}; + +/** + * @class ACE_Hash_Map_Reverse_Const_Iterator + * + * @brief Wrapper for backward compatibility. + */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +class ACE_Hash_Map_Reverse_Const_Iterator + : public ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> +{ +public: + // = Initialization method. + ACE_Hash_Map_Reverse_Const_Iterator (ACE_Hash_Map_Manager<EXT_ID, + INT_ID, ACE_LOCK> &mm, + int tail = 0); + + /// Construct from base + ACE_Hash_Map_Reverse_Const_Iterator + (const ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); + + /// Assignment from base + ACE_Hash_Map_Reverse_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> & + operator= (const ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> &base); }; #if defined (__ACE_INLINE__) diff --git a/ace/Hash_Map_Manager_T.i b/ace/Hash_Map_Manager_T.i index 778bbbd0d13..400540781ea 100644 --- a/ace/Hash_Map_Manager_T.i +++ b/ace/Hash_Map_Manager_T.i @@ -3,184 +3,387 @@ #include "ace/Guard_T.h" -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -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 *alloc) +/* BEGIN ACE_Hash_Map_Manager_Ex */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +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 *alloc) : allocator_ (alloc), table_ (0), total_size_ (0), cur_size_ (0) { if (this->open (size, alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); + { + ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (ACE_Allocator *alloc) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::ACE_Hash_Map_Manager_Ex +(ACE_Allocator *alloc) : allocator_ (alloc), table_ (0), total_size_ (0), cur_size_ (0) { if (this->open (ACE_DEFAULT_MAP_SIZE, alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); + { + ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::close (void) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->close_i (); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::unbind_all (void) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_all_i (); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::~ACE_Hash_Map_Manager_Ex (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::~ACE_Hash_Map_Manager_Ex (void) { this->close (); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::current_size (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::current_size (void) const { return this->cur_size_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::total_size (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::total_size (void) const { return this->total_size_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE ACE_LOCK & -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::mutex (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_LOCK & +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::mutex (void) { ACE_TRACE ("ACE_Hash_Map_Manager_Ex::mutex"); return this->lock_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE u_long -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::hash (const EXT_ID &ext_id) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE u_long +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::hash (const EXT_ID &ext_id) { return this->hash_key_ (ext_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { return this->compare_keys_ (id1, id2); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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> *temp; return this->bind_i (ext_id, int_id, temp); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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> *temp; int result = this->trybind_i (ext_id, int_id, temp); if (result == 1) - int_id = temp->int_id_; + { + int_id = temp->int_id_; + } return result; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->trybind_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->trybind_i (ext_id, int_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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; return this->unbind_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::unbind (const EXT_ID &ext_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id) == -1 ? -1 : 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (entry) == -1 ? -1 : 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) - return -1; + { + return -1; + } else { int_id = entry->int_id_; @@ -188,8 +391,17 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_ } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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; @@ -197,12 +409,23 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_ return this->shared_find (ext_id, entry, dummy); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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 -{ - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = - (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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 +{ + ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> *nc_this = + (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> *) this; ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); @@ -210,31 +433,65 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find return nc_this->find_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id) const -{ - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = - (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::find (const EXT_ID &ext_id) const +{ + ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> *nc_this = + (ACE_Hash_Map_Manager_Ex<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); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { size_t dummy; return this->shared_find (ext_id, entry, dummy); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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 -{ - ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this = - (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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 +{ + ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> *nc_this = + (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> *) this; ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); @@ -242,9 +499,18 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find return nc_this->find_i (ext_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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> *node; @@ -253,10 +519,19 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin node); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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> *node; @@ -266,11 +541,20 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin node); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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> *node; @@ -281,100 +565,339 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin node); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_int_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE 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) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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>::begin (void) -{ - return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::begin (void) +{ + return ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE 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>::end (void) -{ - return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -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>::rbegin (void) -{ - return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -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>::rend (void) +ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::end (void) +{ + return ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} + +/// Read-only forward iterators +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +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>::begin (void) const +{ + return ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +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>::end (void) const +{ + return ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +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>::rbegin (void) +{ + return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +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>::rend (void) +{ + return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} + +// Read-only reverse iterators +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_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>::rbegin (void) const +{ + return ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_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>::rend (void) const +{ + return ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} +/* END ACE_Hash_Map_Manager_Ex */ + +/* BEGIN ACE_Hash_Map_Manager */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Manager<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Allocator *alloc) + : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (alloc) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Manager<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Manager (size_t size, + ACE_Allocator *alloc) + : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, + ACE_LOCK> (size, alloc) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +int +ACE_Hash_Map_Manager<EXT_ID, + INT_ID, + ACE_LOCK>::equal (const EXT_ID &id1, + const EXT_ID &id2) +{ + return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::equal (id1, id2); +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +u_long +ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::hash (const EXT_ID &ext_id) { - return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); -} + return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::hash (ext_id); +} +/* END ACE_Hash_Map_Manager */ + +/* BEGIN ACE_Hash_Map_Iterator_Base_Ex */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex +(ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int head) -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, - int head) : map_man_ (&mm), index_ (head != 0 ? -1 : (ssize_t) mm.total_size_), next_ (0) @@ -382,11 +905,24 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex"); if (mm.table_ != 0) - this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; + { + this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::next +(ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const + { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next"); @@ -399,11 +935,22 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: return 1; } else - return 0; + { + return 0; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::done (void) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done"); @@ -412,11 +959,21 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: || this->index_ < 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Entry<EXT_ID, INT_ID> & -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator* (void) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*"); + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0; int result = this->next (retv); @@ -429,35 +986,486 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: // Returns the reference to the hash_map_manager_ex that is being // iterated over. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void) +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::map (void) { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map"); + return *this->map_man_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator== +(const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator=="); + return this->map_man_ == rhs.map_man_ && this->index_ == rhs.index_ && this->next_ == rhs.next_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator!= +(const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!="); + return this->next_ != rhs.next_ || this->index_ != rhs.index_ || this->map_man_ != rhs.map_man_; } +/* END ACE_Hash_Map_Iterator_Base_Ex */ -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, - int head) +/* BEGIN ACE_Hash_Map_Iterator_Ex */ +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Ex) + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE void +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump (void) const +{ + +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + this->dump_i (); + +#endif /* ACE_HAS_DUMP */ +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::ACE_Hash_Map_Iterator_Ex +(ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> (mm, + tail == 0 ? 1 : 0) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex"); + + if (tail == 0) + { + this->forward_i (); + } +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::advance (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + + return this->forward_i (); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + + this->forward_i (); + return *this; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (int) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); + + ++*this; + return retv; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + + this->reverse_i (); + return *this; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (int) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> retv (*this); + + --*this; + return retv; +} +/* END ACE_Hash_Map_Iterator_Ex */ + +/* BEGIN ACE_Hash_Map_Iterator */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Iterator +(ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, + tail) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Iterator +(const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) + : ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> & +ACE_Hash_Map_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::operator= +(const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) +{ + if (this != &rhs) + { + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; + + base = rhs; + } + + return *this; +} +/* END ACE_Hash_Map_Iterator */ + +/* BEGIN ACE_Hash_Map_Reverse_Iterator_Ex */ +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator_Ex) + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE void +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + this->dump_i (); + +#endif /* ACE_HAS_DUMP */ +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex +(ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &mm, int head) + : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> (mm, head) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex"); + + if (head == 0) + { + this->reverse_i (); + } +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::advance (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + + return this->reverse_i (); +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + + this->reverse_i (); + return *this; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (int) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + + ++*this; + return retv; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + + this->forward_i (); + return *this; +} + +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (int) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); + + --*this; + return retv; +} +/* END ACE_Hash_Map_Reverse_Iterator_Ex */ + +/* BEGIN ACE_Hash_Map_Reverse_Iterator */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator +(ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, + tail) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator +(const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) + : ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> & +ACE_Hash_Map_Reverse_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::operator= +(const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) +{ + if (this != &rhs) + { + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; + + base = rhs; + } + + return *this; +} +/* END ACE_Hash_Map_Reverse_Iterator */ + +/* BEGIN ACE_Hash_Map_Const_Iterator_Base_Ex */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>:: +ACE_Hash_Map_Const_Iterator_Base_Ex +(const ACE_Hash_Map_Manager_Ex<EXT_ID, + INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int head) : map_man_ (&mm), index_ (head != 0 ? -1 : (ssize_t) mm.total_size_), next_ (0) @@ -465,11 +1473,23 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Base_Ex"); if (mm.table_ != 0) - this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; + { + this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::next +(ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next"); @@ -482,11 +1502,22 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ return 1; } else - return 0; + { + return 0; + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::done (void) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done"); @@ -495,11 +1526,21 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ || this->index_ < 0; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Entry<EXT_ID, INT_ID> & -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator* (void) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*"); + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0; int result = this->next (retv); @@ -512,180 +1553,500 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ // Returns the reference to the hash_map_manager_ex that is being // iterated over. -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK>& + +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::map (void) { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map"); return *this->map_man_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator== +(const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator=="); + return this->map_man_ == rhs.map_man_ && this->index_ == rhs.index_ && this->next_ == rhs.next_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator!= +(const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!="); + return this->next_ != rhs.next_ || this->index_ != rhs.index_ || this->map_man_ != rhs.map_man_; } +/* END ACE_Hash_Map_Const_Iterator_Base_Ex */ -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Ex) +/* BEGIN ACE_Hash_Map_Const_Iterator_Ex */ +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Ex) -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE void +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); this->dump_i (); + #endif /* ACE_HAS_DUMP */ } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, - int tail) - : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, - tail == 0 ? 1 : 0) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Ex +(const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, + HASH_KEY, COMPARE_KEYS, + ACE_LOCK> (mm, + tail == 0 ? 1 : 0) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Ex"); + if (tail == 0) - this->forward_i (); + { + this->forward_i (); + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::advance (void) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + return this->forward_i (); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (void) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); this->forward_i (); return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (int) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); ++*this; return retv; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (void) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); this->reverse_i (); return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (int) { - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); --*this; return retv; } +/* END ACE_Hash_Map_Const_Iterator_Ex */ + +/* BEGIN ACE_Hash_Map_Const_Iterator */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Const_Iterator +(const ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> (mm, + tail) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::ACE_Hash_Map_Const_Iterator +(const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) + : ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> & +ACE_Hash_Map_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::operator= +(const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) +{ + if (this != &rhs) + { + ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Ex) + base = rhs; + } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const + return *this; +} +/* BEGIN ACE_Hash_Map_Const_Iterator */ + +/* BEGIN ACE_Hash_Map_Reverse_Const_Iterator_Ex */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE void +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); this->dump_i (); + #endif /* ACE_HAS_DUMP */ } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, - int tail) - : ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Ex"); - if (tail == 0) - this->forward_i (); +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>:: +ACE_Hash_Map_Reverse_Const_Iterator_Ex +(const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> &mm, int head) + : ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, + ACE_LOCK> (mm, head) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Const_Iterator_Ex"); + + if (head == 0) + { + this->reverse_i (); + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::advance (void) { - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); - return this->forward_i (); + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + + return this->reverse_i (); } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (void) { - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); - this->forward_i (); + this->reverse_i (); return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (int) { - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); ++*this; return retv; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (void) { - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); - this->reverse_i (); + this->forward_i (); return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (int) { - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + ACE_TRACE ("ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); --*this; return retv; } +/* BEGIN ACE_Hash_Map_Reverse_Const_Iterator_Ex */ + +/* BEGIN ACE_Hash_Map_Reverse_Const_Iterator */ +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>:: +ACE_Hash_Map_Reverse_Const_Iterator +(ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, + INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> (mm, + tail) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>:: +ACE_Hash_Map_Reverse_Const_Iterator +(const ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) + : ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, + ACE_Equal_To<EXT_ID>, + ACE_LOCK> (base) +{ +} + +template <class EXT_ID, + class INT_ID, + class ACE_LOCK> +ACE_Hash_Map_Reverse_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> & +ACE_Hash_Map_Reverse_Const_Iterator<EXT_ID, + INT_ID, + ACE_LOCK>::operator= +(const ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) +{ + if (this != &rhs) + { + ACE_Hash_Map_Reverse_Const_Iterator_Ex<EXT_ID, INT_ID, + ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, - const EXT_ID &ext_id, - int tail) + base = rhs; + } + + return *this; +} +/* BEGIN ACE_Hash_Map_Reverse_Const_Iterator */ + +/* BEGIN ACE_Hash_Map_Bucket_Iterator */ +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>:: +ACE_Hash_Map_Bucket_Iterator +(ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, + ACE_LOCK> &mm, + const EXT_ID &ext_id, + int tail) : map_man_ (&mm) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Bucket_Iterator"); @@ -694,12 +2055,24 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:: this->next_ = &this->map_man_->table_[this->index_]; if (tail == 0) - this->forward_i (); + { + this->forward_i (); + } } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (void) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); @@ -707,20 +2080,41 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:: return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator++ (int) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); + ++*this; return retv; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE +ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (void) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); @@ -728,19 +2122,39 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:: return *this; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator-- (int) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); - ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> retv (*this); + --*this; return retv; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::forward_i (void) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i"); @@ -748,8 +2162,17 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:: return this->next_ != &this->map_man_->table_[this->index_]; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void) +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::reverse_i (void) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i"); @@ -757,211 +2180,81 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:: return this->next_ != &this->map_man_->table_[this->index_]; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Entry<EXT_ID, INT_ID> & -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator* (void) const { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*"); return *this->next_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void) +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::map (void) { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map"); return *this->map_man_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator== +(const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator=="); + return this->map_man_ == rhs.map_man_ && this->index_ == rhs.index_ && this->next_ == rhs.next_; } -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +template <class EXT_ID, + class INT_ID, + class HASH_KEY, + class COMPARE_KEYS, + class ACE_LOCK> +ACE_INLINE int +ACE_Hash_Map_Bucket_Iterator<EXT_ID, + INT_ID, + HASH_KEY, + COMPARE_KEYS, + ACE_LOCK>::operator!= +(const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, + COMPARE_KEYS, ACE_LOCK> &rhs) const { ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!="); + return this->next_ != rhs.next_ || this->index_ != rhs.index_ || this->map_man_ != rhs.map_man_; } +/* END ACE_Hash_Map_Bucket_Iterator */ -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator_Ex) - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int head) - : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, head) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex"); - if (head == 0) - this->reverse_i (); -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); - return this->reverse_i (); -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); - - this->reverse_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); - - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); - ++*this; - return retv; -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); - - this->forward_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); - - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); - --*this; - return retv; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Allocator *alloc) - : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (alloc) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (size_t size, - ACE_Allocator *alloc) - : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (size, - alloc) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::equal (const EXT_ID &id1, const EXT_ID &id2) -{ - return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::equal (id1, id2); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> u_long -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::hash (const EXT_ID &ext_id) -{ - return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::hash (ext_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int tail) - : ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, - tail) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) - : ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) -{ - if (this != &rhs) - { - ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; - - base = rhs; - } - - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int tail) - : ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, - tail) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) - : ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) -{ - if (this != &rhs) - { - ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; - - base = rhs; - } - - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int head) - : ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, - head) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base) - : ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base) -{ -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs) -{ - ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this; - - base = rhs; - - return *this; -} diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp index 26a41c0cd98..9fd2e1effec 100644 --- a/tests/Hash_Map_Manager_Test.cpp +++ b/tests/Hash_Map_Manager_Test.cpp @@ -40,22 +40,68 @@ static const size_t STRING_TABLE_SIZE = sizeof (HASH_STRING_ENTRY) * (STRING_TABLE_ENTRIES + MAX_HASH); #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class ACE_Hash_Map_Entry<const ACE_TCHAR *, const ACE_TCHAR *>; -template class ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Const_Iterator_Base_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Const_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex>; + +template class ACE_Hash_Map_Iterator_Base_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex>; + +template class ACE_Hash_Map_Const_Iterator_Base_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex>; + +template class ACE_Hash_Map_Iterator_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex>; + +template class ACE_Hash_Map_Const_Iterator_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex>; + +template class ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Reverse_Const_Iterator_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; + template class ACE_Static_Allocator<STRING_TABLE_SIZE>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + #pragma instantiate ACE_Hash_Map_Entry<const ACE_TCHAR *, const ACE_TCHAR *> + #pragma instantiate ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Hash_Map_Const_Iterator_Base_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Hash_Map_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Hash_Map_Const_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Reverse_Const_Iterator_Ex<const ACE_TCHAR *, const ACE_TCHAR *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> + #pragma instantiate ACE_Static_Allocator<STRING_TABLE_SIZE> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -85,6 +131,12 @@ typedef ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> HASH_STRING_REVERSE_ITER; +typedef ACE_Hash_Map_Reverse_Const_Iterator_Ex<const ACE_TCHAR *, + const ACE_TCHAR *, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + ACE_Null_Mutex> HASH_STRING_REVERSE_CONST_ITER; + struct String_Table { const ACE_TCHAR *key_; @@ -221,7 +273,25 @@ run_test (void) hash_iter.advance ()) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("iterating (%d): [%s, %s]\n"), + ACE_TEXT ("reverse iterating (%d): [%s, %s]\n"), + i, + entry->ext_id_, + entry->int_id_)); + i++; + } + } + + // Let's test the const iterator backwards. + { + HASH_STRING_ENTRY *entry; + size_t i = 0; + + for (HASH_STRING_REVERSE_CONST_ITER hash_iter (hash); + hash_iter.next (entry) != 0; + hash_iter.advance ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("const reverse iterating (%d): [%s, %s]\n"), i, entry->ext_id_, entry->int_id_)); |