Map_Manager.cpp

Go to the documentation of this file.
00001 // Map_Manager.cpp,v 4.83 2005/10/28 16:14:53 ossama Exp
00002 
00003 #ifndef ACE_MAP_MANAGER_CPP
00004 #define ACE_MAP_MANAGER_CPP
00005 
00006 #include "ace/Map_Manager.h"
00007 
00008 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00009 # pragma once
00010 #endif /* ACE_LACKS_PRAGMA_ONCE */
00011 
00012 #include "ace/Malloc_Base.h"
00013 
00014 #if !defined (__ACE_INLINE__)
00015 #include "ace/Map_Manager.inl"
00016 #endif /* __ACE_INLINE__ */
00017 
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Entry)
00021 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Manager)
00022 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Const_Iterator_Base)
00023 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Iterator_Base)
00024 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Const_Iterator)
00025 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Iterator)
00026 ACE_ALLOC_HOOK_DEFINE(ACE_Map_Reverse_Iterator)
00027 
00028 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00029 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::open (size_t size,
00030                                                  ACE_Allocator *alloc)
00031 {
00032   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00033 
00034   // Close old map (if any).
00035   this->close_i ();
00036 
00037   // Use the user specified allocator or the default singleton one.
00038   if (alloc == 0)
00039     alloc = ACE_Allocator::instance ();
00040 
00041   this->allocator_ = alloc;
00042 
00043   // This assertion is here to help track a situation that shouldn't
00044   // happen.
00045   ACE_ASSERT (size != 0);
00046 
00047   // Active_Map_Manager depends on the <slot_index_> being of fixed
00048   // size. It cannot be size_t because size_t is 64-bits on 64-bit
00049   // platform and 32-bits on 32-bit platforms. Size of the <slot_index_>
00050   // has to be consistent across platforms. ACE_UIN32 is chosen as
00051   // ACE_UIN32_MAX is big enough. The assert is to ensure that the user
00052   // doesn't open the ACE_Map_Manager with a bigger size than we can
00053   // handle.
00054   ACE_ASSERT (size <= ACE_UINT32_MAX);
00055 
00056   // Resize from 0 to <size>.  Note that this will also set up the
00057   // circular free list.
00058   return this->resize_i ((ACE_UINT32) size);
00059 }
00060 
00061 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00062 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::close_i (void)
00063 {
00064   // Free entries.
00065   this->free_search_structure ();
00066 
00067   // Reset sizes.
00068   this->total_size_ = 0;
00069   this->cur_size_ = 0;
00070 
00071   // Reset circular free list.
00072   this->free_list_.next (this->free_list_id ());
00073   this->free_list_.prev (this->free_list_id ());
00074 
00075   // Reset circular occupied list.
00076   this->occupied_list_.next (this->occupied_list_id ());
00077   this->occupied_list_.prev (this->occupied_list_id ());
00078 
00079   return 0;
00080 }
00081 
00082 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00083 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
00084                                                    const INT_ID &int_id)
00085 {
00086   // Try to find the key.
00087   ACE_UINT32 slot = 0;
00088   int result = this->find_and_return_index (ext_id,
00089                                             slot);
00090 
00091   if (result == 0)
00092     // We found the key. Nothing to change.
00093     return 1;
00094   else
00095     // We didn't find the key.
00096     return this->shared_bind (ext_id,
00097                               int_id);
00098 }
00099 
00100 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00101 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::next_free (ACE_UINT32 &free_slot)
00102 {
00103   // Look in the free list for an empty slot.
00104   free_slot = this->free_list_.next ();
00105 
00106   // If we do find a free slot, return successfully.
00107   if (free_slot != this->free_list_id ())
00108     return 0;
00109 
00110 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00111 
00112   // Move any free slots from occupied list to free list.
00113   this->move_all_free_slots_from_occupied_list ();
00114 
00115   // Try again in case we found any free slots in the occupied list.
00116   free_slot = this->free_list_.next ();
00117 
00118   // If we do find a free slot, return successfully.
00119   if (free_slot != this->free_list_id ())
00120     return 0;
00121 
00122 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00123 
00124   // Resize the map.
00125   int result = this->resize_i (this->new_size ());
00126 
00127   // Check for errors.
00128   if (result == 0)
00129     // New free slot.
00130     free_slot = this->free_list_.next ();
00131 
00132   return result;
00133 }
00134 
00135 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00136 
00137 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00138 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::move_all_free_slots_from_occupied_list (void)
00139 {
00140   //
00141   // In the case of lazy map managers, the movement of free slots from
00142   // the occupied list to the free list is delayed until we run out of
00143   // free slots in the free list.
00144   //
00145 
00146   // Go through the entire occupied list, moving free slots to the
00147   // free list. Note that all free slots in the occupied list are
00148   // moved in this loop.
00149   for (ACE_UINT32 i = this->occupied_list_.next ();
00150        i != this->occupied_list_id ();
00151        )
00152     {
00153       //
00154       // Note the trick used here: Information about the current slot
00155       // is first noted; <i> then moves to the next occupied slot;
00156       // only after this is the slot (potentially) moved from the
00157       // occupied list to the free list.  This order of things, i.e.,
00158       // moving <i> before moving the free slot is necessary,
00159       // otherwise we'll forget which our next occupied slot is.
00160       //
00161 
00162       // Note information about current slot.
00163       ACE_Map_Entry<EXT_ID, INT_ID> &current_slot = this->search_structure_[i];
00164       ACE_UINT32 position_of_current_slot = i;
00165 
00166       // Move <i> to next occupied slot.
00167       i = this->search_structure_[i].next ();
00168 
00169       // If current slot is free
00170       if (current_slot.free_)
00171         {
00172           // Reset free flag to zero before moving to free list.
00173           current_slot.free_ = 0;
00174 
00175           // Move from occupied list to free list.
00176           this->move_from_occupied_list_to_free_list (position_of_current_slot);
00177         }
00178     }
00179 }
00180 
00181 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00182 
00183 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00184 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::shared_move (ACE_UINT32 slot,
00185                                                         ACE_Map_Entry<EXT_ID, INT_ID> &current_list,
00186                                                         ACE_UINT32 current_list_id,
00187                                                         ACE_Map_Entry<EXT_ID, INT_ID> &new_list,
00188                                                         ACE_UINT32 new_list_id)
00189 {
00190   // Grab the entry.
00191   ENTRY &entry = this->search_structure_[slot];
00192 
00193   // Remove from current list.
00194 
00195   // Fix the entry before us.
00196   ACE_UINT32 current_list_prev = entry.prev ();
00197 
00198   if (current_list_prev == current_list_id)
00199     current_list.next (entry.next ());
00200   else
00201     this->search_structure_[current_list_prev].next (entry.next ());
00202 
00203   // Fix the entry after us.
00204   ACE_UINT32 current_list_next = entry.next ();
00205 
00206   if (current_list_next == current_list_id)
00207     current_list.prev (entry.prev ());
00208   else
00209     this->search_structure_[current_list_next].prev (entry.prev ());
00210 
00211   // Add to new list.
00212 
00213   // Fix us.
00214   ACE_UINT32 new_list_next = new_list.next ();
00215   entry.next (new_list_next);
00216   entry.prev (new_list_id);
00217 
00218   // Fix entry before us.
00219   new_list.next (slot);
00220 
00221   // Fix entry after us.
00222   if (new_list_next == new_list_id)
00223     new_list.prev (slot);
00224   else
00225     this->search_structure_[new_list_next].prev (slot);
00226 }
00227 
00228 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00229 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::shared_bind (const EXT_ID &ext_id,
00230                                                         const INT_ID &int_id)
00231 {
00232   // This function assumes that the find() has already been done, and
00233   // therefore, simply adds to the map.
00234 
00235   // Find an empty slot.
00236   ACE_UINT32 slot = 0;
00237   int result = this->next_free (slot);
00238 
00239   if (result == 0)
00240     {
00241       // Copy key and value.
00242       this->search_structure_[slot].int_id_ = int_id;
00243       this->search_structure_[slot].ext_id_ = ext_id;
00244 
00245       // Move from free list to occupied list
00246       this->move_from_free_list_to_occupied_list (slot);
00247 
00248       // Update the current size.
00249       ++this->cur_size_;
00250     }
00251 
00252   return result;
00253 }
00254 
00255 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00256 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00257                                                      const INT_ID &int_id,
00258                                                      EXT_ID &old_ext_id,
00259                                                      INT_ID &old_int_id)
00260 {
00261   // First try to find the key.
00262   ACE_UINT32 slot = 0;
00263   int result = this->find_and_return_index (ext_id,
00264                                             slot);
00265   if (result == 0)
00266     {
00267       // We found it, so make copies of the old entries and rebind
00268       // current entries.
00269       ENTRY &ss = this->search_structure_[slot];
00270       old_ext_id = ss.ext_id_;
00271       old_int_id = ss.int_id_;
00272       ss.ext_id_ = ext_id;
00273       ss.int_id_ = int_id;
00274 
00275       // Sync changed entry.
00276       this->allocator_->sync (&ss, sizeof ss);
00277 
00278       return 1;
00279     }
00280   else
00281     // We didn't find it, so let's add it.
00282     return this->shared_bind (ext_id,
00283                               int_id);
00284 }
00285 
00286 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00287 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00288                                                      const INT_ID &int_id,
00289                                                      INT_ID &old_int_id)
00290 {
00291   // First try to find the key.
00292   ACE_UINT32 slot = 0;
00293   int result = this->find_and_return_index (ext_id,
00294                                             slot);
00295   if (result == 0)
00296     {
00297       // We found it, so make copies of the old entries and rebind
00298       // current entries.
00299       ENTRY &ss = this->search_structure_[slot];
00300       old_int_id = ss.int_id_;
00301       ss.ext_id_ = ext_id;
00302       ss.int_id_ = int_id;
00303 
00304       // Sync changed entry.
00305       this->allocator_->sync (&ss, sizeof ss);
00306 
00307       return 1;
00308     }
00309   else
00310     // We didn't find it, so let's add it.
00311     return this->shared_bind (ext_id,
00312                               int_id);
00313 }
00314 
00315 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00316 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
00317                                                      const INT_ID &int_id)
00318 {
00319   // First try to find the key.
00320   ACE_UINT32 slot = 0;
00321   int result = this->find_and_return_index (ext_id,
00322                                             slot);
00323   if (result == 0)
00324     {
00325       // We found it, so rebind current entries.
00326       ENTRY &ss = this->search_structure_[slot];
00327       ss.ext_id_ = ext_id;
00328       ss.int_id_ = int_id;
00329 
00330       // Sync changed entry.
00331       this->allocator_->sync (&ss, sizeof ss);
00332 
00333       return 1;
00334     }
00335   else
00336     // We didn't find it, so let's add it.
00337     return this->shared_bind (ext_id,
00338                               int_id);
00339 }
00340 
00341 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00342 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind_i (const EXT_ID &ext_id,
00343                                                       INT_ID &int_id)
00344 {
00345   // Try to find the key.
00346   ACE_UINT32 slot = 0;
00347   int result = this->find_and_return_index (ext_id,
00348                                             slot);
00349   if (result == 0)
00350     {
00351       // Key was found.  Make a copy of value, but *don't* update
00352       // anything in the map!
00353       int_id = this->search_structure_[slot].int_id_;
00354       return 1;
00355     }
00356   else
00357     // We didn't find it, so let's bind it!
00358     return this->bind_i (ext_id,
00359                          int_id);
00360 }
00361 
00362 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00363 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find_and_return_index (const EXT_ID &ext_id,
00364                                                                   ACE_UINT32 &slot)
00365 {
00366   // Go through the entire occupied list looking for the key.
00367   for (ACE_UINT32 i = this->occupied_list_.next ();
00368        i != this->occupied_list_id ();
00369        i = this->search_structure_[i].next ())
00370     {
00371 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00372       if (this->search_structure_[i].free_)
00373         continue;
00374 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00375 
00376       if (this->equal (this->search_structure_[i].ext_id_,
00377                        ext_id))
00378         {
00379           // If found, return slot.
00380           slot = i;
00381           return 0;
00382         }
00383     }
00384 
00385   // Key was not found.
00386   return -1;
00387 }
00388 
00389 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00390 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_all (void)
00391 {
00392   // Go through the entire occupied list.
00393   for (ACE_UINT32 i = this->occupied_list_.next ();
00394        i != this->occupied_list_id ();
00395        )
00396     {
00397       //
00398       // Note the trick used here: Information about the current slot
00399       // is first noted; <i> then moves to the next occupied slot;
00400       // only after this is the slot (potentially) moved from the
00401       // occupied list to the free list.  This order of things, i.e.,
00402       // moving <i> before moving the free slot is necessary,
00403       // otherwise we'll forget which our next occupied slot is.
00404       //
00405 
00406       // Note information about current slot.
00407       ACE_Map_Entry<EXT_ID, INT_ID> &current_slot =
00408         this->search_structure_[i];
00409       ACE_UINT32 position_of_current_slot = i;
00410 
00411       // Move <i> to next occupied slot.
00412       i = current_slot.next ();
00413 
00414 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00415       if (current_slot.free_)
00416         continue;
00417 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00418 
00419       this->unbind_slot (position_of_current_slot);
00420     }
00421 }
00422 
00423 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00424 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find_i (const EXT_ID &ext_id,
00425                                                    INT_ID &int_id)
00426 {
00427   // Try to find the key.
00428   ACE_UINT32 slot = 0;
00429   int result = this->find_and_return_index (ext_id,
00430                                             slot);
00431   if (result == 0)
00432     // Key was found.  Make a copy of value.
00433     int_id = this->search_structure_[slot].int_id_;
00434 
00435   return result;
00436 }
00437 
00438 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00439 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_and_return_index (const EXT_ID &ext_id,
00440                                                                     ACE_UINT32 &slot)
00441 {
00442   // Try to find the key.
00443   int result = this->find_and_return_index (ext_id,
00444                                             slot);
00445 
00446   if (result == 0)
00447     this->unbind_slot (slot);
00448 
00449   return result;
00450 }
00451 
00452 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00453 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_slot (ACE_UINT32 slot)
00454 {
00455 
00456 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00457 
00458   //
00459   // In the case of lazy map managers, the movement of free slots
00460   // from the occupied list to the free list is delayed until we
00461   // run out of free slots in the free list.
00462   //
00463 
00464   this->search_structure_[slot].free_ = 1;
00465 
00466 #else
00467 
00468   // Move from occupied list to free list.
00469   this->move_from_occupied_list_to_free_list (slot);
00470 
00471 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00472 
00473   // Update the current size.
00474   --this->cur_size_;
00475 }
00476 
00477 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00478 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (const EXT_ID &ext_id,
00479                                                      INT_ID &int_id)
00480 {
00481   // Unbind the entry.
00482   ACE_UINT32 slot = 0;
00483   int result = this->unbind_and_return_index (ext_id,
00484                                               slot);
00485   if (result == 0)
00486     // If found, copy the value.
00487     int_id = this->search_structure_[slot].int_id_;
00488 
00489   return result;
00490 }
00491 
00492 template <class EXT_ID, class INT_ID, class ACE_LOCK> int
00493 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::resize_i (ACE_UINT32 new_size)
00494 {
00495   ACE_UINT32 i;
00496   ENTRY *temp = 0;
00497 
00498   // Allocate new memory.
00499   ACE_ALLOCATOR_RETURN (temp,
00500                         (ENTRY *) this->allocator_->malloc (new_size * sizeof (ENTRY)),
00501                         -1);
00502 
00503   // Copy over the occupied entires.
00504   for (i = this->occupied_list_.next ();
00505        i != this->occupied_list_id ();
00506        i = this->search_structure_[i].next ())
00507     // Call the copy constructor using operator placement new.
00508     new (&(temp[i])) ENTRY (this->search_structure_[i]);
00509 
00510   // Copy over the free entires.
00511   for (i = this->free_list_.next ();
00512        i != this->free_list_id ();
00513        i = this->search_structure_[i].next ())
00514     // Call the copy constructor using operator placement new.
00515     new (&(temp[i])) ENTRY (this->search_structure_[i]);
00516 
00517   // Construct the new elements.
00518   for (i = this->total_size_; i < new_size; i++)
00519     {
00520       // Call the constructor for each element in the array using
00521       // operator placement new.  Note that this requires a default
00522       // constructor for <EXT_ID> and <INT_ID>.
00523       new (&(temp[i])) ENTRY;
00524       temp[i].next (i + 1);
00525       temp[i].prev (i - 1);
00526 
00527 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00528 
00529       // Even though this slot is initially free, we need the <free_>
00530       // flag to be zero so that we don't have to set it when the slot
00531       // is moved to the occupied list.  In addition, this flag has no
00532       // meaning while this slot is in the free list.
00533       temp[i].free_ = 0;
00534 
00535 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00536 
00537     }
00538 
00539   // Add new entries to the free list.
00540   this->free_list_.next (this->total_size_);
00541   this->free_list_.prev (new_size - 1);
00542   temp[new_size - 1].next (this->free_list_id ());
00543   temp[this->total_size_].prev (this->free_list_id ());
00544 
00545   // Remove/free old elements, update the new totoal size.
00546   this->free_search_structure ();
00547   this->total_size_ = new_size;
00548 
00549   // Start using new elements.
00550   this->search_structure_ = temp;
00551 
00552   return 0;
00553 }
00554 
00555 template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_UINT32
00556 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::new_size (void)
00557 {
00558   // Calculate the new size.
00559   ACE_UINT32 current_size = this->total_size_;
00560 
00561   if (current_size < MAX_EXPONENTIAL)
00562     // Exponentially increase if we haven't reached MAX_EXPONENTIAL.
00563     current_size *= 2;
00564   else
00565     // Linear increase if we have reached MAX_EXPONENTIAL.
00566     current_size += LINEAR_INCREASE;
00567 
00568   // This should be the new size.
00569   return current_size;
00570 }
00571 
00572 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00573 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::free_search_structure (void)
00574 {
00575   // Free up the structure.
00576   if (this->search_structure_ != 0)
00577     {
00578       for (ACE_UINT32 i = 0; i < this->total_size_; i++)
00579         // Explicitly call the destructor.
00580         {
00581           ENTRY *ss = &this->search_structure_[i];
00582           // The "if" second argument results in a no-op instead of
00583           // deallocation.
00584           ACE_DES_FREE_TEMPLATE2 (ss, ACE_NOOP,
00585                                   ACE_Map_Entry, EXT_ID, INT_ID);
00586         }
00587 
00588       // Actually free the memory.
00589       this->allocator_->free (this->search_structure_);
00590       this->search_structure_ = 0;
00591     }
00592 }
00593 
00594 template <class EXT_ID, class INT_ID> void
00595 ACE_Map_Entry<EXT_ID, INT_ID>::dump (void) const
00596 {
00597 #if defined (ACE_HAS_DUMP)
00598   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00599   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("next_ = %d"), this->next_));
00600   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("prev_ = %d"), this->prev_));
00601 
00602 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00603   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("free_ = %d"), this->free_));
00604 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00605 
00606   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00607 #endif /* ACE_HAS_DUMP */
00608 }
00609 
00610 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00611 ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const
00612 {
00613 #if defined (ACE_HAS_DUMP)
00614   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00615   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("total_size_ = %d"), this->total_size_));
00616   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\ncur_size_ = %d"), this->cur_size_));
00617   this->allocator_->dump ();
00618   this->lock_.dump ();
00619   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00620 #endif /* ACE_HAS_DUMP */
00621 }
00622 
00623 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00624 ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::dump_i (void) const
00625 {
00626 #if defined (ACE_HAS_DUMP)
00627   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00628   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("next_ = %d"), this->next_));
00629   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00630 #endif /* ACE_HAS_DUMP */
00631 }
00632 
00633 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00634 ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::dump_i (void) const
00635 {
00636 #if defined (ACE_HAS_DUMP)
00637   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00638   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("next_ = %d"), this->next_));
00639   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00640 #endif /* ACE_HAS_DUMP */
00641 }
00642 
00643 template <class EXT_ID, class INT_ID, class ACE_LOCK>
00644 ACE_Map_Entry<EXT_ID, INT_ID>&
00645 ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator* (void) const
00646 {
00647   // @@ This function should be inlined.  We moved it here to avoid a
00648   // compiler bug in SunCC 4.2.  Once we know the correct patch to fix
00649   // the compiler problem, it should be moved back to .i file again.
00650   ACE_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00651 
00652   int result = this->next (retv);
00653   ACE_ASSERT (result != 0);
00654   ACE_UNUSED_ARG (result);
00655 
00656   return *retv;
00657 }
00658 
00659 template <class EXT_ID, class INT_ID, class ACE_LOCK>
00660 ACE_Map_Entry<EXT_ID, INT_ID>&
00661 ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator* (void) const
00662 {
00663   // @@ This function should be inlined.  We moved it here to avoid a
00664   // compiler bug in SunCC 4.2.  Once we know the correct patch to fix
00665   // the compiler problem, it should be moved back to .i file again.
00666   ACE_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00667 
00668   int result = this->next (retv);
00669   ACE_ASSERT (result != 0);
00670   ACE_UNUSED_ARG (result);
00671 
00672   return *retv;
00673 }
00674 
00675 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00676 ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const
00677 {
00678 #if defined (ACE_HAS_DUMP)
00679   this->dump_i ();
00680 #endif /* ACE_HAS_DUMP */
00681 }
00682 
00683 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00684 ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const
00685 {
00686 #if defined (ACE_HAS_DUMP)
00687   this->dump_i ();
00688 #endif /* ACE_HAS_DUMP */
00689 }
00690 
00691 template <class EXT_ID, class INT_ID, class ACE_LOCK> void
00692 ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const
00693 {
00694 #if defined (ACE_HAS_DUMP)
00695   this->dump_i ();
00696 #endif /* ACE_HAS_DUMP */
00697 }
00698 
00699 ACE_END_VERSIONED_NAMESPACE_DECL
00700 
00701 #endif /* ACE_MAP_MANAGER_CPP */

Generated on Thu Nov 9 09:41:54 2006 for ACE by doxygen 1.3.6