00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_Hash_Multi_Map_Manager_T_CPP
00014 #define ACE_Hash_Multi_Map_Manager_T_CPP
00015
00016 #include "ace/Hash_Multi_Map_Manager_T.h"
00017
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 # pragma once
00020 #endif
00021
00022 #if !defined (__ACE_INLINE__)
00023 # include "ace/Hash_Multi_Map_Manager_T.inl"
00024 #endif
00025
00026 #include "ace/Malloc_Base.h"
00027
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029
00030
00031 template <class EXT_ID, class INT_ID>
00032 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Multi_Map_Entry (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next,
00033 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev)
00034 : next_ (next),
00035 prev_ (prev)
00036 {
00037 }
00038
00039 template <class EXT_ID, class INT_ID>
00040 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Multi_Map_Entry (const EXT_ID &ext_id,
00041 const ACE_Unbounded_Set<INT_ID> &int_id_set,
00042 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next,
00043 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev)
00044 : ext_id_ (ext_id),
00045 int_id_set_ (int_id_set),
00046 next_ (next),
00047 prev_ (prev)
00048 {
00049 }
00050
00051 # if ! defined (ACE_HAS_BROKEN_NOOP_DTORS)
00052 template <class EXT_ID, class INT_ID>
00053 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::~ACE_Hash_Multi_Map_Entry (void)
00054 {
00055 }
00056 # endif
00057
00058 template <class EXT_ID, class INT_ID> EXT_ID &
00059 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::key ()
00060 {
00061 return ext_id_;
00062 }
00063
00064 template <class EXT_ID, class INT_ID> ACE_Unbounded_Set<INT_ID> &
00065 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::item ()
00066 {
00067 return int_id_set_;
00068 }
00069
00070 template <class EXT_ID, class INT_ID> void
00071 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::dump (void) const
00072 {
00073 #if defined (ACE_HAS_DUMP)
00074 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00075 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %d"), this->next_));
00076 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prev_ = %d"), this->prev_));
00077 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00078 #endif
00079 }
00080
00081 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void
00082 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
00083 {
00084 #if defined (ACE_HAS_DUMP)
00085 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00086 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d"), this->total_size_));
00087 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_));
00088 this->table_allocator_->dump ();
00089 this->entry_allocator_->dump ();
00090 this->lock_.dump ();
00091 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00092 #endif
00093 }
00094
00095 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00096 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::create_buckets (size_t size)
00097 {
00098 size_t bytes = size * sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>);
00099 void *ptr;
00100
00101 ACE_ALLOCATOR_RETURN (ptr,
00102 this->table_allocator_->malloc (bytes),
00103 -1);
00104
00105 this->table_ = (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *) ptr;
00106
00107 this->total_size_ = size;
00108
00109
00110
00111
00112 for (size_t i = 0; i < size; i++)
00113 new (&this->table_[i]) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (&this->table_[i],
00114 &this->table_[i]);
00115 return 0;
00116 }
00117
00118 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00119 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open (size_t size,
00120 ACE_Allocator *table_alloc,
00121 ACE_Allocator *entry_alloc)
00122 {
00123 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00124
00125
00126
00127 this->close_i ();
00128
00129 if (table_alloc == 0)
00130 table_alloc = ACE_Allocator::instance ();
00131
00132 this->table_allocator_ = table_alloc;
00133
00134 if (entry_alloc == 0)
00135 entry_alloc = table_alloc;
00136
00137 this->entry_allocator_ = entry_alloc;
00138
00139
00140
00141
00142
00143 if (size == 0)
00144 return -1;
00145
00146 return this->create_buckets (size);
00147 }
00148
00149 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00150 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close_i (void)
00151 {
00152
00153
00154 if (this->table_ != 0)
00155 {
00156
00157 this->unbind_all_i ();
00158
00159
00160 for (size_t i = 0; i < this->total_size_; i++)
00161 {
00162
00163 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i];
00164
00165
00166
00167 ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP,
00168 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID);
00169 }
00170
00171
00172 this->total_size_ = 0;
00173
00174
00175 this->table_allocator_->free (this->table_);
00176
00177
00178 this->table_ = 0;
00179 }
00180
00181 return 0;
00182 }
00183
00184 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00185 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all_i (void)
00186 {
00187
00188
00189 for (size_t i = 0; i < this->total_size_; i++)
00190 {
00191 for (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_;
00192 temp_ptr != &this->table_[i];
00193 )
00194 {
00195 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr;
00196 temp_ptr = temp_ptr->next_;
00197
00198
00199 ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free,
00200 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID);
00201 }
00202
00203
00204 this->table_[i].next_ = &this->table_[i];
00205 this->table_[i].prev_ = &this->table_[i];
00206 }
00207
00208 this->cur_size_ = 0;
00209
00210 return 0;
00211 }
00212
00213 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00214 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
00215 const INT_ID &int_id,
00216 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00217 {
00218 size_t loc;
00219 int result = this->shared_find (ext_id, entry, loc);
00220
00221 ACE_Unbounded_Set<INT_ID> int_id_set;
00222 if (result == -1)
00223 {
00224 void *ptr;
00225
00226 ACE_ALLOCATOR_RETURN (ptr,
00227 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)),
00228 -1);
00229
00230 int_id_set.insert (int_id);
00231
00232 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id,
00233 int_id_set,
00234 this->table_[loc].next_,
00235 &this->table_[loc]);
00236 this->table_[loc].next_ = entry;
00237 entry->next_->prev_ = entry;
00238 this->cur_size_++;
00239 return 0;
00240 }
00241 else
00242 {
00243 int_id_set = (*entry).int_id_set_;
00244
00245 if (0 == int_id_set.insert (int_id))
00246 {
00247 this->unbind_i (entry);
00248 return this->bind_i (ext_id, int_id_set);
00249 }
00250 else
00251 return 1;
00252 }
00253 }
00254
00255 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00256 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
00257 const ACE_Unbounded_Set<INT_ID> &int_id_set,
00258 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00259 {
00260 size_t loc;
00261 int result = this->shared_find (ext_id, entry, loc);
00262
00263 if (result == -1)
00264 {
00265 void *ptr;
00266
00267 ACE_ALLOCATOR_RETURN (ptr,
00268 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)),
00269 -1);
00270
00271 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id,
00272 int_id_set,
00273 this->table_[loc].next_,
00274 &this->table_[loc]);
00275 this->table_[loc].next_ = entry;
00276 entry->next_->prev_ = entry;
00277 this->cur_size_++;
00278 return 0;
00279 }
00280 else
00281 return 1;
00282 }
00283
00284 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00285 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i (const EXT_ID &ext_id,
00286 ACE_Unbounded_Set<INT_ID> &int_id_set,
00287 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00288 {
00289 size_t loc;
00290 int result = this->shared_find (ext_id, entry, loc);
00291
00292 if (result == -1)
00293 {
00294
00295 void *ptr;
00296 ACE_ALLOCATOR_RETURN (ptr,
00297 this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>)),
00298 -1);
00299
00300 entry = new (ptr) ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> (ext_id,
00301 int_id_set,
00302 this->table_[loc].next_,
00303 &this->table_[loc]);
00304 this->table_[loc].next_ = entry;
00305 entry->next_->prev_ = entry;
00306 this->cur_size_++;
00307 return 0;
00308 }
00309 else
00310 return 1;
00311 }
00312
00313 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00314 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id,
00315 ACE_Unbounded_Set<INT_ID> &int_id_set)
00316 {
00317 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp;
00318
00319 size_t loc;
00320 int result = this->shared_find (ext_id, temp, loc);
00321
00322 if (result == -1)
00323 {
00324 errno = ENOENT;
00325 return -1;
00326 }
00327
00328 int_id_set = temp->int_id_set_;
00329
00330 return this->unbind_i (temp);
00331 }
00332
00333 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00334 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry)
00335 {
00336 entry->next_->prev_ = entry->prev_;
00337 entry->prev_->next_ = entry->next_;
00338
00339
00340 ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free,
00341 ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID);
00342
00343 this->cur_size_--;
00344 return 0;
00345 }
00346
00347 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00348 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id,
00349 const INT_ID &int_id)
00350 {
00351 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp;
00352
00353 size_t loc;
00354 int result = this->shared_find (ext_id, temp, loc);
00355
00356 if (result == -1)
00357 {
00358 errno = ENOENT;
00359 return -1;
00360 }
00361
00362 ACE_Unbounded_Set<INT_ID> int_id_set = (*temp).int_id_set_;
00363 if (0 == int_id_set.remove (int_id))
00364 {
00365 this->unbind_i (temp);
00366
00367 if (0 != int_id_set.size ())
00368 return this->bind_i (ext_id, int_id_set);
00369 else
00370 return 0;
00371 }
00372 else
00373 return -1;
00374 }
00375
00376
00377 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00378 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::shared_find (const EXT_ID &ext_id,
00379 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry,
00380 size_t &loc)
00381 {
00382 loc = this->hash (ext_id) % this->total_size_;
00383
00384 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_;
00385
00386 while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0)
00387 temp = temp->next_;
00388
00389 if (temp == &this->table_[loc])
00390 {
00391 errno = ENOENT;
00392 return -1;
00393 }
00394 else
00395 {
00396 entry = temp;
00397 return 0;
00398 }
00399 }
00400
00401 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00402 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00403 const ACE_Unbounded_Set<INT_ID> &int_id_set,
00404 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00405 {
00406 size_t dummy;
00407 if (this->shared_find (ext_id, entry, dummy) == -1)
00408 return this->bind_i (ext_id, int_id_set);
00409 else
00410 {
00411 entry->ext_id_ = ext_id;
00412 entry->int_id_set_ = int_id_set;
00413 return 1;
00414 }
00415 }
00416
00417 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00418 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00419 const ACE_Unbounded_Set<INT_ID> &int_id_set,
00420 ACE_Unbounded_Set<INT_ID> &old_int_id_set,
00421 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00422 {
00423 size_t dummy;
00424 if (this->shared_find (ext_id, entry, dummy) == -1)
00425 return this->bind_i (ext_id, int_id_set);
00426 else
00427 {
00428 old_int_id_set = entry->int_id_set_;
00429 entry->ext_id_ = ext_id;
00430 entry->int_id_set_ = int_id_set;
00431 return 1;
00432 }
00433 }
00434
00435 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00436 ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00437 const ACE_Unbounded_Set<INT_ID> &int_id_set,
00438 EXT_ID &old_ext_id,
00439 ACE_Unbounded_Set<INT_ID> &old_int_id_set,
00440 ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
00441 {
00442 size_t dummy;
00443 if (this->shared_find (ext_id, entry, dummy) == -1)
00444 return this->bind_i (ext_id, int_id_set);
00445 else
00446 {
00447 old_ext_id = entry->ext_id_;
00448 old_int_id_set = entry->int_id_set_;
00449 entry->ext_id_ = ext_id;
00450 entry->int_id_set_ = int_id_set;
00451 return 1;
00452 }
00453 }
00454
00455
00456
00457 ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Iterator_Base)
00458
00459 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void
00460 ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i (void) const
00461 {
00462 ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i");
00463
00464 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00465 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_));
00466 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_));
00467 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00468 }
00469
00470 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00471 ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void)
00472 {
00473 ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
00474
00475 if (this->map_man_->table_ == 0)
00476 return -1;
00477
00478 else if (this->index_ == -1)
00479 {
00480 this->index_++;
00481 return this->forward_i ();
00482 }
00483 else if (this->index_ >= static_cast<ssize_t> (this->map_man_->total_size_))
00484 return 0;
00485
00486 this->next_ = this->next_->next_;
00487 if (this->next_ == &this->map_man_->table_[this->index_])
00488 {
00489 while (++this->index_ < static_cast<ssize_t> (this->map_man_->total_size_))
00490 {
00491 this->next_ = this->map_man_->table_[this->index_].next_;
00492 if (this->next_ != &this->map_man_->table_[this->index_])
00493 break;
00494 }
00495 }
00496
00497 return this->index_ < static_cast<ssize_t> (this->map_man_->total_size_);
00498 }
00499
00500 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00501 ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void)
00502 {
00503 ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
00504
00505 if (this->map_man_->table_ == 0)
00506 return -1;
00507 else if (this->index_ == static_cast<ssize_t> (this->map_man_->total_size_))
00508 {
00509 this->index_--;
00510 return this->reverse_i ();
00511 }
00512 else if (this->index_ < 0)
00513 return 0;
00514
00515 this->next_ = this->next_->prev_;
00516 if (this->next_ == &this->map_man_->table_[this->index_])
00517 {
00518 while (--this->index_ >= 0)
00519 {
00520 this->next_ = this->map_man_->table_[this->index_].prev_;
00521 if (this->next_ != &this->map_man_->table_[this->index_])
00522 break;
00523 }
00524 }
00525
00526 return this->index_ >= 0;
00527 }
00528
00529
00530
00531 ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Const_Iterator_Base)
00532
00533 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void
00534 ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i (void) const
00535 {
00536 ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i");
00537
00538 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00539 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_));
00540 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_));
00541 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00542 }
00543
00544 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00545 ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void)
00546 {
00547 ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
00548
00549 if (this->map_man_->table_ == 0)
00550 return -1;
00551
00552 else if (this->index_ == -1)
00553 {
00554 this->index_++;
00555 return this->forward_i ();
00556 }
00557 else if (this->index_ >= (ssize_t) this->map_man_->total_size_)
00558 return 0;
00559
00560 this->next_ = this->next_->next_;
00561 if (this->next_ == &this->map_man_->table_[this->index_])
00562 {
00563 while (++this->index_ < (ssize_t) this->map_man_->total_size_)
00564 {
00565 this->next_ = this->map_man_->table_[this->index_].next_;
00566 if (this->next_ != &this->map_man_->table_[this->index_])
00567 break;
00568 }
00569 }
00570
00571 return this->index_ < (ssize_t) this->map_man_->total_size_;
00572 }
00573
00574 template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
00575 ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void)
00576 {
00577 ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
00578
00579 if (this->map_man_->table_ == 0)
00580 return -1;
00581 else if (this->index_ == (ssize_t) this->map_man_->total_size_)
00582 {
00583 this->index_--;
00584 return this->reverse_i ();
00585 }
00586 else if (this->index_ < 0)
00587 return 0;
00588
00589 this->next_ = this->next_->prev_;
00590 if (this->next_ == &this->map_man_->table_[this->index_])
00591 {
00592 while (--this->index_ >= 0)
00593 {
00594 this->next_ = this->map_man_->table_[this->index_].prev_;
00595 if (this->next_ != &this->map_man_->table_[this->index_])
00596 break;
00597 }
00598 }
00599
00600 return this->index_ >= 0;
00601 }
00602
00603 ACE_END_VERSIONED_NAMESPACE_DECL
00604
00605 #endif