EventMain Class Reference

#include <eventbase.h>

List of all members.


Detailed Description

This Singleton class is the application main event system.

Users should never need to access this class directly - it is accessed from EventTableBase constructor/destructors.

The purpose of this class is to provide a central list of event tables, and wait for events. When event occours, mainLoop() makes a virtual function call HandleEvents() on each registred event table, handling all pending events.

Note:
Everything here must be thread-safe and protected through mutexes.

Definition at line 63 of file eventbase.h.


Public Member Functions

void addEventTable (EventTableBase *et)
 Add event table.
void removeEventTable (EventTableBase *et)
 Remove event table.
void mainLoop ()
 Enter main event loop. This runs until someone calls ExitMainLoop().
void handlePending ()
 Handle all pending events in current queues.
void exitMainLoop ()
 Exit main loop.

Static Public Member Functions

static EventMaininstance ()
 Can be used to retrieve the only instance of this class.
static void initialize ()
 Initialize this object.

Private Types

typedef std::list< EventTableBase
* >::iterator 
LIter

Private Member Functions

 EventMain ()
 Constructor.
 EventMain (const EventMain &)
 Copying forbidden.
EventMainoperator= (EventMain &)
 Copying forbidden.
 ~EventMain ()
 Destructor.

Private Attributes

std::list< EventTableBase * > m_list
 List of event tables.
boost::mutex m_listLock
bool m_running
 Runs until this is true.
boost::mutex m_runningLock

Member Typedef Documentation

typedef std::list<EventTableBase*>::iterator EventMain::LIter [private]
 

Definition at line 94 of file eventbase.h.


Constructor & Destructor Documentation

EventMain::EventMain  )  [inline, private]
 

Constructor.

Definition at line 98 of file eventbase.h.

References m_running.

EventMain::EventMain const EventMain  )  [private]
 

Copying forbidden.

EventMain::~EventMain  )  [inline, private]
 

Destructor.

Definition at line 101 of file eventbase.h.


Member Function Documentation

void EventMain::addEventTable EventTableBase et  )  [inline]
 

Add event table.

Definition at line 73 of file eventbase.h.

References m_list, and m_listLock.

Referenced by EventTableBase::EventTableBase().

void EventMain::exitMainLoop  ) 
 

Exit main loop.

Notice that this function returns immediately, but application exit will be delayed until next event loop.

Definition at line 48 of file eventbase.cpp.

References m_running, m_runningLock, and EventTableBase::notify().

Here is the call graph for this function:

void EventMain::handlePending  ) 
 

Handle all pending events in current queues.

Definition at line 42 of file eventbase.cpp.

References m_list.

Referenced by HydraNode::doLoop(), HydraNode::mainLoop(), and mainLoop().

static void EventMain::initialize  )  [inline, static]
 

Initialize this object.

Definition at line 69 of file eventbase.h.

References instance().

Referenced by HydraNode::mainLoop().

Here is the call graph for this function:

EventMain & EventMain::instance  )  [static]
 

Can be used to retrieve the only instance of this class.

Definition at line 24 of file eventbase.cpp.

Referenced by HydraNode::doLoop(), EventTableBase::EventTableBase(), initialize(), and HydraNode::mainLoop().

void EventMain::mainLoop  ) 
 

Enter main event loop. This runs until someone calls ExitMainLoop().

Definition at line 29 of file eventbase.cpp.

References handlePending(), m_running, m_runningLock, EventTableBase::setNoPending(), and EventTableBase::waitForEvent().

Here is the call graph for this function:

EventMain& EventMain::operator= EventMain  )  [private]
 

Copying forbidden.

void EventMain::removeEventTable EventTableBase et  )  [inline]
 

Remove event table.

Definition at line 78 of file eventbase.h.

References m_list, and m_listLock.


Member Data Documentation

std::list<EventTableBase*> EventMain::m_list [private]
 

List of event tables.

Definition at line 92 of file eventbase.h.

Referenced by addEventTable(), handlePending(), and removeEventTable().

boost::mutex EventMain::m_listLock [private]
 

Definition at line 93 of file eventbase.h.

Referenced by addEventTable(), and removeEventTable().

bool EventMain::m_running [private]
 

Runs until this is true.

Definition at line 95 of file eventbase.h.

Referenced by EventMain(), exitMainLoop(), and mainLoop().

boost::mutex EventMain::m_runningLock [private]
 

Definition at line 96 of file eventbase.h.

Referenced by exitMainLoop(), and mainLoop().


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