Public Types | Public Member Functions | Public Attributes | Private Attributes

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 417 of file Select_Reactor_Base.h.


Member Typedef Documentation

Definition at line 422 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.

    : rep_ (s),
      current_ (s->event_handlers_.begin ())
{
#ifndef ACE_WIN32
  // Don't use ACE_Array_Base::end() since it may be larger than
  // event_handlers[max_handlep1_].
  const_base_iterator const end =
    &this->rep_->event_handlers_[this->rep_->max_handlep1 ()];

  // Advance to the next element containing a non-zero event handler.
  // There's no need to do this for the Windows case since the hash
  // map will only contain non-zero event handlers.
  while (this->current_ != end && (*(this->current_) == 0))
    ++this->current_;
#endif
}


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.

{
#ifdef ACE_WIN32
  // No need to explicitly limit search to "current" to
  // max_handlep1_ range.
  const_base_iterator const end = this->rep_->event_handlers_.end ();
#else
  // Don't use ACE_Array_Base::end() since it may be larger than
  // event_handlers[max_handlep1_].
  const_base_iterator const end =
    &this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
#endif  /* ACE_WIN32 */

  if (this->current_ != end)
    ++this->current_;

#ifndef ACE_WIN32
  // Advance to the next element containing a non-zero event handler.
  // There's no need to do this for the Windows case since the hash
  // map will only contain non-zero event handlers.
  while (this->current_ != end && (*(this->current_) == 0))
    ++this->current_;
#endif  /* !ACE_WIN32 */

  return this->current_ != end;
}

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.

{
#ifdef ACE_WIN32
  return this->current_ == this->rep_->event_handlers_.end ();
#else
  return this->current_ == (this->rep_->event_handlers_.begin ()
                            + this->rep_->max_handlep1 ());
#endif /* ACE_WIN32 */
}

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.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Select_Reactor_Handler_Repository_Iterator::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rep_ = %u"), this->rep_));
# ifdef ACE_WIN32
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = ")));
  this->current_.dump ();
# else
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = %@"), this->current_));
# endif  /* ACE_WIN32 */
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}

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.

{
  bool result = true;

  if (this->done ())
    result = false;
  else
    next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->current_);

  return result;
}


Member Data Documentation

Declare the dynamic allocation hooks.

Definition at line 445 of file Select_Reactor_Base.h.

Pointer to the current iteration level.

Definition at line 453 of file Select_Reactor_Base.h.

Reference to the Handler_Repository we are iterating over.

Definition at line 450 of file Select_Reactor_Base.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines