21 #ifndef G_EVENT_HANDLER_H
22 #define G_EVENT_HANDLER_H
35 class EventHandlerList ;
99 typedef std::map<Descriptor,EventHandler*>
Map ;
129 Iterator
begin()
const ;
132 Iterator
end()
const ;
146 void collectGarbage() ;
151 unsigned int m_lock ;
Iterator begin() const
Returns a forward iterator.
virtual void readEvent()
Called for a read event.
A network file descriptor.
void lock()
Called at the start of an iteration which might change the list.
std::map< Descriptor, EventHandler * > Map
virtual void onException(std::exception &)=0
Called when an exception is thrown out of readEvent(), writeEvent() or exceptionEvent().
virtual void writeEvent()
Called for a write event.
Map::const_iterator Iterator
bool contains(Descriptor fd) const
Returns true if the list contains the given file-descriptor.
static Descriptor fd(Iterator i)
Returns the iterator's file descriptor.
A base class for classes that handle asynchronous socket events.
static EventHandler * handler(Iterator i)
Returns the iterator's handler.
void add(Descriptor fd, EventHandler *handler)
Adds a file-descriptor/handler pair to the list.
void unlock()
Called at the end of an iteration.
Iterator end() const
Returns an end iterator.
EventHandlerList(const std::string &type)
Constructor.
EventHandler * find(Descriptor fd)
Finds the handler associated with the given file descriptor.
virtual ~EventHandler()
Destructor.
virtual void exceptionEvent()
Called for an exception event.
A class which can be used in the implemention of classes derived from GNet::EventLoop.