GNet::EventHandlerList Class Reference

A class which can be used in the implemention of classes derived from GNet::EventLoop. More...

#include <geventhandler.h>

List of all members.

Public Types

typedef std::map< Descriptor,
EventHandler * > 
Map
typedef Map::const_iterator Iterator

Public Member Functions

 EventHandlerList (const std::string &type)
 Constructor.
void add (Descriptor fd, EventHandler *handler)
 Adds a file-descriptor/handler pair to the list.
void remove (Descriptor fd)
 Removes a file-descriptor from the list.
bool contains (Descriptor fd) const
 Returns true if the list contains the given file-descriptor.
EventHandlerfind (Descriptor fd)
 Finds the handler associated with the given file descriptor.
void lock ()
 Called at the start of an iteration which might change the list.
void unlock ()
 Called at the end of an iteration.
Iterator begin () const
 Returns a forward iterator.
Iterator end () const
 Returns an end iterator.

Static Public Member Functions

static Descriptor fd (Iterator i)
 Returns the iterator's file descriptor.
static EventHandlerhandler (Iterator i)
 Returns the iterator's handler.


Detailed Description

A class which can be used in the implemention of classes derived from GNet::EventLoop.

Definition at line 96 of file geventhandler.h.


Member Typedef Documentation

Definition at line 99 of file geventhandler.h.

typedef Map::const_iterator GNet::EventHandlerList::Iterator

Definition at line 100 of file geventhandler.h.


Constructor & Destructor Documentation

GNet::EventHandlerList::EventHandlerList ( const std::string &  type  )  [explicit]

Constructor.

The type parameter (eg. "read") is used only in debugging messages.

Definition at line 52 of file geventhandler.cpp.


Member Function Documentation

void GNet::EventHandlerList::add ( Descriptor  fd,
EventHandler handler 
)

Adds a file-descriptor/handler pair to the list.

Definition at line 80 of file geventhandler.cpp.

References G_ASSERT, and G_DEBUG.

Referenced by GNet::Select::addException(), GNet::Select::addRead(), and GNet::Select::addWrite().

void GNet::EventHandlerList::remove ( Descriptor  fd  ) 

Removes a file-descriptor from the list.

Definition at line 88 of file geventhandler.cpp.

References G_DEBUG.

Referenced by GNet::Select::dropException(), GNet::Select::dropRead(), and GNet::Select::dropWrite().

bool GNet::EventHandlerList::contains ( Descriptor  fd  )  const

Returns true if the list contains the given file-descriptor.

Definition at line 69 of file geventhandler.cpp.

GNet::EventHandler * GNet::EventHandlerList::find ( Descriptor  fd  ) 

Finds the handler associated with the given file descriptor.

Definition at line 74 of file geventhandler.cpp.

void GNet::EventHandlerList::lock (  ) 

Called at the start of an iteration which might change the list.

Definition at line 106 of file geventhandler.cpp.

Referenced by GNet::Lock::Lock().

void GNet::EventHandlerList::unlock (  ) 

Called at the end of an iteration.

Definition at line 111 of file geventhandler.cpp.

References G_ASSERT.

Referenced by GNet::Lock::~Lock().

GNet::EventHandlerList::Iterator GNet::EventHandlerList::begin (  )  const

Returns a forward iterator.

Definition at line 59 of file geventhandler.cpp.

Referenced by GNet::FdSet::init(), and GNet::FdSet::raiseEvents().

GNet::EventHandlerList::Iterator GNet::EventHandlerList::end (  )  const

Returns an end iterator.

Definition at line 64 of file geventhandler.cpp.

Referenced by GNet::FdSet::init(), and GNet::FdSet::raiseEvents().

GNet::Descriptor GNet::EventHandlerList::fd ( Iterator  i  )  [inline, static]

Returns the iterator's file descriptor.

Definition at line 156 of file geventhandler.h.

Referenced by GNet::FdSet::init(), and GNet::FdSet::raiseEvents().

GNet::EventHandler * GNet::EventHandlerList::handler ( Iterator  i  )  [inline, static]

Returns the iterator's handler.

Returns null if the fd has been remove()d but the list is still lock()ed.

Definition at line 162 of file geventhandler.h.

Referenced by GNet::FdSet::raiseEvents().


The documentation for this class was generated from the following files:

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5