Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Map_Iterator_Base Class Template Reference

Iterator for the ACE_Map_Manager. More...

#include <Map_Manager.h>

Inheritance diagram for ACE_Map_Iterator_Base:

Inheritance graph
[legend]
Collaboration diagram for ACE_Map_Iterator_Base:

Collaboration graph
[legend]
List of all members.

Public Methods

 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. More...

int next (ACE_Map_Entry< EXT_ID, INT_ID > *&next_entry) const
 Pass back the next <entry> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1. More...

int done (void) const
 Returns 1 when all items have been seen, else 0. More...

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

ACE_Map_Manager< EXT_ID, INT_ID,
ACE_LOCK > & 
map (void)
 Returns reference the Map_Manager that is being iterated over. More...

int operator== (const ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > &) const
 Check if two iterators point to the same position. More...

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

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

int forward_i (void)
 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. More...

int reverse_i (void)
 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. More...

void dump_i (void) const
 Dump the state of an object. More...


Protected Attributes

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

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


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 448 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 268 of file Map_Manager.i.

00269   : map_man_ (&mm),
00270     next_ (this->map_man_->occupied_list_id ())
00271 {
00272 }


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 287 of file Map_Manager.i.

References map_man_, and next_.

Referenced by ACE_Map_Iterator::ACE_Map_Iterator, ACE_Map_Reverse_Iterator::ACE_Map_Reverse_Iterator, forward_i, and reverse_i.

00288 {
00289   return this->next_ == this->map_man_->occupied_list_id ();
00290 }

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 627 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::dump, and ACE_Map_Iterator::dump.

00628 {
00629   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00630   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("next_ = %d"), this->next_));
00631   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00632 }

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 293 of file Map_Manager.i.

References done, map_man_, and next_.

Referenced by ACE_Map_Iterator::advance, ACE_Map_Iterator::operator++, and ACE_Map_Reverse_Iterator::operator--.

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

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 356 of file Map_Manager.i.

References map_man_.

00357 {
00358   return *this->map_man_;
00359 }

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 <entry> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1.

Definition at line 275 of file Map_Manager.i.

References map_man_, and next_.

Referenced by ACE_Token_Collection::acquire, ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::cancel, ACE_WIN32_Asynch_Connect::cancel_uncompleted, ACE_POSIX_Asynch_Connect::cancel_uncompleted, ACE_Token_Manager::check_deadlock, operator *, ACE_Token_Collection::release, ACE_Token_Collection::renew, ACE_Token_Manager::token_waiting_for, ACE_Token_Collection::tryacquire, ACE_Token_Collection::~ACE_Token_Collection, ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager, and ACE_Token_Manager::~ACE_Token_Manager.

00276 {
00277   if (this->next_ != this->map_man_->occupied_list_id ())
00278     {
00279       mm = &this->map_man_->search_structure_[this->next_];
00280       return 1;
00281     }
00282   else
00283     return 0;
00284 }

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 <this> is pointing to.

Definition at line 644 of file Map_Manager.cpp.

References ACE_ASSERT, and next.

00645 {
00646   // @@ This function should be inlined.  We moved it here to avoid a
00647   // compiler bug in SunCC 4.2.  Once we know the correct patch to fix
00648   // the compiler problem, it should be moved back to .i file again.
00649   ACE_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00650 
00651   int result = this->next (retv);
00652   ACE_ASSERT (result != 0);
00653   ACE_UNUSED_ARG (result);
00654 
00655   return *retv;
00656 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int 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 369 of file Map_Manager.i.

References operator==.

00370 {
00371   return !this->operator== (rhs);
00372 }

template<class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_INLINE int 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 362 of file Map_Manager.i.

References map_man_, and next_.

Referenced by operator!=.

00363 {
00364   return (this->map_man_ == rhs.map_man_ &&
00365           this->next_ == rhs.next_);
00366 }

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 324 of file Map_Manager.i.

References done, map_man_, and next_.

Referenced by ACE_Map_Reverse_Iterator::advance, ACE_Map_Reverse_Iterator::operator++, and ACE_Map_Iterator::operator--.

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


Member Data Documentation

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

Declare the dynamic allocation hooks.

Reimplemented in ACE_Map_Iterator.

Definition at line 477 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::map_man_ [protected]
 

Map we are iterating over.

Definition at line 492 of file Map_Manager.h.

Referenced by ACE_Map_Iterator::ACE_Map_Iterator, ACE_Map_Reverse_Iterator::ACE_Map_Reverse_Iterator, done, forward_i, map, next, operator==, and reverse_i.

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

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

Definition at line 495 of file Map_Manager.h.

Referenced by ACE_Map_Iterator::ACE_Map_Iterator, ACE_Map_Reverse_Iterator::ACE_Map_Reverse_Iterator, done, forward_i, next, operator==, and reverse_i.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:50:04 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002