VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GNet::EventHandlerList Class Reference

A class that maps from a file descriptor to an event handler, used in the implemention of classes derived from GNet::EventLoop. More...

#include <geventhandler.h>

Classes

struct  Iterator
 An iterator for file-descriptor/handler-function pairs in a GNet::EventHandlerList. More...
 

Public Member Functions

 EventHandlerList (const std::string &type)
 Constructor. More...
 
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 ()
 To be called at the start of an begin()/end() iteration if the list might change during the iteration. More...
 
void unlock ()
 Called at the end of a begin()/end() iteration to match a call to lock(). More...
 
void collectGarbage ()
 Collects garbage resulting from remove()s. More...
 
Iterator begin () const
 Returns a forward iterator.
 
Iterator end () const
 Returns an end iterator.
 

Detailed Description

A class that maps from a file descriptor to an event handler, used in the implemention of classes derived from GNet::EventLoop.

Definition at line 105 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 64 of file geventhandler.cpp.

Member Function Documentation

void GNet::EventHandlerList::collectGarbage ( )

Collects garbage resulting from remove()s.

Automatically called from unlock().

Definition at line 175 of file geventhandler.cpp.

void GNet::EventHandlerList::lock ( )

To be called at the start of an begin()/end() iteration if the list might change during the iteration.

Must be paired with unlock().

Definition at line 147 of file geventhandler.cpp.

void GNet::EventHandlerList::unlock ( )

Called at the end of a begin()/end() iteration to match a call to lock().

Does garbage collection.

Definition at line 152 of file geventhandler.cpp.


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