ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > Class Template Reference

Iterator for the ACE_Map_Manager. More...

#include <Map_Manager.h>

Inheritance diagram for ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ACE_Map_Iterator_Base (ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK > &mm)
int next (ACE_Map_Entry< EXT_ID, INT_ID > *&next_entry) const
int done (void) const
 Returns 1 when all items have been seen, else 0.

ACE_Map_Entry< EXT_ID, INT_ID > & operator * (void) const
 Returns a reference to the interal element is pointing to.

ACE_Map_Manager< EXT_ID, INT_ID,
ACE_LOCK > & 
map (void)
bool operator== (const ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > &) const
 Check if two iterators point to the same position.

bool operator!= (const ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > &) const

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Protected Member Functions

int forward_i (void)
int reverse_i (void)
void dump_i (void) const
 Dump the state of an object.


Protected Attributes

ACE_Map_Manager< EXT_ID, INT_ID,
ACE_LOCK > * 
map_man_
 Map we are iterating over.

ACE_UINT32 next_
 Keeps track of how far we've advanced...


Detailed Description

template<class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >

Iterator for the ACE_Map_Manager.

This class factors out common code from its templatized subclasses.

Definition at line 452 of file Map_Manager.h.


Constructor & Destructor Documentation

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::ACE_Map_Iterator_Base ACE_Map_Manager< EXT_ID, INT_ID, 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.

Definition at line 274 of file Map_Manager.inl.

00275   : map_man_ (&mm),
00276     next_ (this->map_man_->occupied_list_id ())
00277 {
00278 }


Member Function Documentation

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::done void   )  const
 

Returns 1 when all items have been seen, else 0.

Definition at line 293 of file Map_Manager.inl.

Referenced by ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >::ACE_Map_Iterator(), ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >::ACE_Map_Reverse_Iterator(), ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::forward_i(), and ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::reverse_i().

00294 {
00295   return this->next_ == this->map_man_->occupied_list_id ();
00296 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
void ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::dump_i void   )  const [protected]
 

Dump the state of an object.

Definition at line 624 of file Map_Manager.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, and LM_DEBUG.

Referenced by ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >::dump(), and ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >::dump().

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 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::forward_i void   )  [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.

Definition at line 299 of file Map_Manager.inl.

References ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::done().

Referenced by ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >::advance(), ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >::operator++(), and ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >::operator--().

00300 {
00301 
00302 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00303 
00304   while (1)
00305     {
00306       // Go to the next item in the list.
00307       this->next_ = this->map_man_->search_structure_[this->next_].next ();
00308 
00309       // Stop if we reach the end.
00310       if (this->done ())
00311         break;
00312 
00313       // Break if we find a non-free slot.
00314       if (!this->map_man_->search_structure_[this->next_].free_)
00315         {
00316           break;
00317         }
00318     }
00319 
00320 #else
00321 
00322   this->next_ = this->map_man_->search_structure_[this->next_].next ();
00323 
00324 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00325 
00326   return this->next_ != this->map_man_->occupied_list_id ();
00327 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK > & ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::map void   ) 
 

Returns reference the Map_Manager that is being iterated over.

Definition at line 362 of file Map_Manager.inl.

00363 {
00364   return *this->map_man_;
00365 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::next ACE_Map_Entry< EXT_ID, INT_ID > *&  next_entry  )  const
 

Pass back the next that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1.

Definition at line 281 of file Map_Manager.inl.

Referenced by ACE_Based_Pointer_Repository::find(), ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator *(), and ACE_Based_Pointer_Repository::unbind().

00282 {
00283   if (this->next_ != this->map_man_->occupied_list_id ())
00284     {
00285       mm = &this->map_man_->search_structure_[this->next_];
00286       return 1;
00287     }
00288   else
00289     return 0;
00290 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Map_Entry< EXT_ID, INT_ID > & ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator * void   )  const
 

Returns a reference to the interal element is pointing to.

Definition at line 645 of file Map_Manager.cpp.

References ACE_ASSERT, and ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::next().

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 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE bool ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator!= const ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > &   )  const
 

Definition at line 375 of file Map_Manager.inl.

References ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator==().

00376 {
00377   return !this->operator== (rhs);
00378 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE bool ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator== const ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > &   )  const
 

Check if two iterators point to the same position.

Definition at line 368 of file Map_Manager.inl.

References ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::map_man_, and ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::next_.

Referenced by ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator!=().

00369 {
00370   return (this->map_man_ == rhs.map_man_ &&
00371           this->next_ == rhs.next_);
00372 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::reverse_i void   )  [protected]
 

Move backware by one element in the set. Returns 0 when there's no more item in the set before the current item, else 1.

Definition at line 330 of file Map_Manager.inl.

References ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::done().

Referenced by ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >::advance(), ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >::operator++(), and ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >::operator--().

00331 {
00332 
00333 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00334 
00335   while (1)
00336     {
00337       // Go to the prev item in the list.
00338       this->next_ = this->map_man_->search_structure_[this->next_].prev ();
00339 
00340       // Stop if we reach the end.
00341       if (this->done ())
00342         break;
00343 
00344       // Break if we find a non-free slot.
00345       if (!this->map_man_->search_structure_[this->next_].free_)
00346         {
00347           break;
00348         }
00349     }
00350 
00351 #else
00352 
00353   this->next_ = this->map_man_->search_structure_[this->next_].prev ();
00354 
00355 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00356 
00357   return this->next_ != this->map_man_->occupied_list_id ();
00358 }


Member Data Documentation

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK >, ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK >, ACE_Map_Iterator< KEY, VALUE, ACE_Null_Mutex >, ACE_Map_Iterator< ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex >, ACE_Map_Reverse_Iterator< KEY, VALUE, ACE_Null_Mutex >, and ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex >.

Definition at line 481 of file Map_Manager.h.

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>* ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::map_man_ [protected]
 

Map we are iterating over.

Definition at line 496 of file Map_Manager.h.

Referenced by ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator==().

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_UINT32 ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::next_ [protected]
 

Keeps track of how far we've advanced...

Definition at line 499 of file Map_Manager.h.

Referenced by ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK >::operator==().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:24:28 2006 for ACE by doxygen 1.3.6