EventTableBase Class Reference

#include <eventbase.h>

Inheritance diagram for EventTableBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

Abstract base class for event engine.

Provides two common features for all event tables:

Notify() function, which need to be used whenever there is new event posted to event queue. This is needed by main event loop to "wake up" and call handlers.

Pure virtual function prototype HandleEvents(), which needs to be overridden by derived classes. This function will be called once per each main event loop and must handle all events in the queue.

EventTableBase class registers itself in central list (main event loop).

Definition at line 118 of file eventbase.h.


Public Member Functions

 EventTableBase ()
 Constructor - Add to central event table list.
virtual ~EventTableBase ()
 Destructor - Remove from central event table list.

Protected Member Functions

virtual void handleEvents ()=0
 Must be overridden by derived classes.

Static Protected Member Functions

static void notify ()
 Notify central event system to wake up.

Static Private Member Functions

static void waitForEvent ()
 For implementation use only - wait until there is a pending event somewhere.
static bool hasPending ()
 Check if there are any pending events anywhere.
static void setNoPending ()
 Toggle pending event flag to false.

Static Private Attributes

static boost::condition s_eventNotify
 Used to broadcast new events.
static boost::mutex s_notifyLock
 Protects the above condition.
static bool s_hasPending = false
 Whether there are any pending events.

Friends

class EventMain

Constructor & Destructor Documentation

EventTableBase::EventTableBase  ) 
 

Constructor - Add to central event table list.

Definition at line 59 of file eventbase.cpp.

References EventMain::addEventTable(), and EventMain::instance().

Here is the call graph for this function:

EventTableBase::~EventTableBase  )  [virtual]
 

Destructor - Remove from central event table list.

Definition at line 62 of file eventbase.cpp.


Member Function Documentation

virtual void EventTableBase::handleEvents  )  [protected, pure virtual]
 

Must be overridden by derived classes.

This is called from central event loop for each of the registred objects. Should handle all pending events (if existing).

Implemented in EventTable< Source, Event >, and SchedBase.

bool EventTableBase::hasPending  )  [static, private]
 

Check if there are any pending events anywhere.

Definition at line 74 of file eventbase.cpp.

References s_hasPending, and s_notifyLock.

void EventTableBase::notify  )  [static, protected]
 

Notify central event system to wake up.

Definition at line 65 of file eventbase.cpp.

References s_eventNotify, s_hasPending, and s_notifyLock.

Referenced by EventMain::exitMainLoop(), SchedEventHandler::ClientEventHandler< Source, Scheduler >::handleConnected(), SchedEventHandler::ClientEventHandler< Source, Scheduler >::handleErr(), SchedEventHandler::ClientEventHandler< Source, Scheduler >::handleWrite(), and EventTable< Source, Event >::postEvent().

void EventTableBase::setNoPending  )  [static, private]
 

Toggle pending event flag to false.

Definition at line 78 of file eventbase.cpp.

References s_hasPending, and s_notifyLock.

Referenced by EventMain::mainLoop().

void EventTableBase::waitForEvent  )  [static, private]
 

For implementation use only - wait until there is a pending event somewhere.

Definition at line 70 of file eventbase.cpp.

References s_eventNotify, and s_notifyLock.

Referenced by EventMain::mainLoop().


Friends And Related Function Documentation

friend class EventMain [friend]
 

Definition at line 119 of file eventbase.h.


Member Data Documentation

boost::condition EventTableBase::s_eventNotify [static, private]
 

Used to broadcast new events.

Definition at line 57 of file eventbase.cpp.

Referenced by notify(), and waitForEvent().

bool EventTableBase::s_hasPending = false [static, private]
 

Whether there are any pending events.

Definition at line 58 of file eventbase.cpp.

Referenced by hasPending(), notify(), and setNoPending().

boost::mutex EventTableBase::s_notifyLock [static, private]
 

Protects the above condition.

Definition at line 56 of file eventbase.cpp.

Referenced by hasPending(), notify(), setNoPending(), and waitForEvent().


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