ACE_Select_Reactor_Handler_Repository_Iterator Class Reference

Iterate through the ACE_Select_Reactor_Handler_Repository. More...

#include <Select_Reactor_Base.h>

Collaboration diagram for ACE_Select_Reactor_Handler_Repository_Iterator:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Select_Reactor_Handler_Repository::map_type::const_iterator const_base_iterator

Public Member Functions

 ACE_Select_Reactor_Handler_Repository_Iterator (ACE_Select_Reactor_Handler_Repository const *s)
bool next (ACE_Event_Handler *&next_item)
bool done (void) const
 Returns true when all items have been seen, else false.
bool advance (void)
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private Attributes

ACE_Select_Reactor_Handler_Repository
const *const 
rep_
 Reference to the Handler_Repository we are iterating over.
const_base_iterator current_
 Pointer to the current iteration level.

Detailed Description

Iterate through the ACE_Select_Reactor_Handler_Repository.

Definition at line 412 of file Select_Reactor_Base.h.


Member Typedef Documentation

typedef ACE_Select_Reactor_Handler_Repository::map_type::const_iterator ACE_Select_Reactor_Handler_Repository_Iterator::const_base_iterator

Definition at line 417 of file Select_Reactor_Base.h.


Constructor & Destructor Documentation

ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repository_Iterator ( ACE_Select_Reactor_Handler_Repository const *  s  )  [explicit]

Definition at line 410 of file Select_Reactor_Base.cpp.

00411     : rep_ (s),
00412       current_ (s->event_handlers_.begin ())
00413 {
00414 #ifndef ACE_WIN32
00415   // Don't use ACE_Array_Base::end() since it may be larger than
00416   // event_handlers[max_handlep1_].
00417   const_base_iterator const end =
00418     &this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
00419 
00420   // Advance to the next element containing a non-zero event handler.
00421   // There's no need to do this for the Windows case since the hash
00422   // map will only contain non-zero event handlers.
00423   while (this->current_ != end && (*(this->current_) == 0))
00424     ++this->current_;
00425 #endif
00426 }


Member Function Documentation

bool ACE_Select_Reactor_Handler_Repository_Iterator::advance ( void   ) 

Move forward by one element in the set. Returns false when all the items in the set have been seen, else true.

Definition at line 448 of file Select_Reactor_Base.cpp.

References current_, ACE_Select_Reactor_Handler_Repository::event_handlers_, ACE_Select_Reactor_Handler_Repository::max_handlep1(), and rep_.

Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handlers(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handlers().

00449 {
00450 #ifdef ACE_WIN32
00451   // No need to explicitly limit search to "current" to
00452   // max_handlep1_ range.
00453   const_base_iterator const end = this->rep_->event_handlers_.end ();
00454 #else
00455   // Don't use ACE_Array_Base::end() since it may be larger than
00456   // event_handlers[max_handlep1_].
00457   const_base_iterator const end =
00458     &this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
00459 #endif  /* ACE_WIN32 */
00460 
00461   if (this->current_ != end)
00462     ++this->current_;
00463 
00464 #ifndef ACE_WIN32
00465   // Advance to the next element containing a non-zero event handler.
00466   // There's no need to do this for the Windows case since the hash
00467   // map will only contain non-zero event handlers.
00468   while (this->current_ != end && (*(this->current_) == 0))
00469     ++this->current_;
00470 #endif  /* !ACE_WIN32 */
00471 
00472   return this->current_ != end;
00473 }

ACE_INLINE bool ACE_Select_Reactor_Handler_Repository_Iterator::done ( void   )  const

Returns true when all items have been seen, else false.

Definition at line 76 of file Select_Reactor_Base.inl.

References current_, ACE_Select_Reactor_Handler_Repository::event_handlers_, ACE_Select_Reactor_Handler_Repository::max_handlep1(), and rep_.

00077 {
00078 #ifdef ACE_WIN32
00079   return this->current_ == this->rep_->event_handlers_.end ();
00080 #else
00081   return this->current_ == (this->rep_->event_handlers_.begin ()
00082                             + this->rep_->max_handlep1 ());
00083 #endif /* ACE_WIN32 */
00084 }

void ACE_Select_Reactor_Handler_Repository_Iterator::dump ( void   )  const

Dump the state of an object.

Definition at line 478 of file Select_Reactor_Base.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, current_, and LM_DEBUG.

00479 {
00480 #if defined (ACE_HAS_DUMP)
00481   ACE_TRACE ("ACE_Select_Reactor_Handler_Repository_Iterator::dump");
00482 
00483   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00484   ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rep_ = %u"), this->rep_));
00485 # ifdef ACE_WIN32
00486   ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = ")));
00487   this->current_.dump ();
00488 # else
00489   ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = %@"), this->current_));
00490 # endif  /* ACE_WIN32 */
00491   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00492 #endif /* ACE_HAS_DUMP */
00493 }

bool ACE_Select_Reactor_Handler_Repository_Iterator::next ( ACE_Event_Handler *&  next_item  ) 

Pass back the next_item that hasn't been seen in the Set. Returns false when all items have been seen, else true.

Definition at line 432 of file Select_Reactor_Base.cpp.

Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::resume_handlers(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::suspend_handlers().

00434 {
00435   bool result = true;
00436 
00437   if (this->done ())
00438     result = false;
00439   else
00440     next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->current_);
00441 
00442   return result;
00443 }


Member Data Documentation

ACE_Select_Reactor_Handler_Repository_Iterator::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Definition at line 440 of file Select_Reactor_Base.h.

const_base_iterator ACE_Select_Reactor_Handler_Repository_Iterator::current_ [private]

Pointer to the current iteration level.

Definition at line 448 of file Select_Reactor_Base.h.

Referenced by advance(), done(), and dump().

ACE_Select_Reactor_Handler_Repository const* const ACE_Select_Reactor_Handler_Repository_Iterator::rep_ [private]

Reference to the Handler_Repository we are iterating over.

Definition at line 445 of file Select_Reactor_Base.h.

Referenced by advance(), and done().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:33 2010 for ACE by  doxygen 1.4.7