Simplified XF 1.1.0
|
Interface for the XF dispatcher providing the event processing loop. More...
#include <dispatcher.h>
Public Member Functions | |
virtual void | pushEvent (XFEvent *pEvent)=0 |
Adds event to the events queue. More... | |
virtual void | scheduleTimeout (int timeoutId, int interval, interface::XFBehavior *pBehavior)=0 |
Adds a new timeout to be handled. More... | |
virtual void | unscheduleTimeout (int timeoutId, interface::XFBehavior *pBehavior)=0 |
Removes all timeouts corresponding the given parameters. More... | |
Static Public Member Functions | |
static XFDispatcher * | getInstance () |
Returns a pointer to the single instance of XFDispatcher. | |
Protected Member Functions | |
XFDispatcher ()=default | |
virtual int | execute (const void *param=nullptr)=0 |
Main loop of the dispatcher. Implements event loop processing. More... | |
virtual void | executeOnce ()=0 |
Executes once the dispatcher. More... | |
virtual void | dispatchEvent (const XFEvent *pEvent) const =0 |
Dispatches the event to the corresponding behavioral part. More... | |
Friends | |
class | ::XF |
class | ::DispatcherThread |
Interface for the XF dispatcher providing the event processing loop.
Depending on the implementation the dispatcher is executed by an internal thread. It is up to the port implementation how the class behaves.
The dispatcher should at least provide a queue to hold events and an algorithm (typically in execute()) that dispatches the queued events to the associated behavior (eq. state machine, activity).
There may exist multiple dispatchers. Each behavior needs to be bound to a dispatcher. One dispatcher may serve different behaviors.
|
protecteddefault |
Constructor is protected because only method createInstance() should be called to create Dispatcher instances
|
protectedpure virtual |
Dispatches the event to the corresponding behavioral part.
For example the state machine which should process the event.
pEvent | The event to dispatch |
Implemented in XFDispatcher.
|
protectedpure virtual |
Main loop of the dispatcher. Implements event loop processing.
Implemented in XFDispatcher.
|
protectedpure virtual |
Executes once the dispatcher.
Usually, this method must not be called explicitly. The standard way to call the dispatcher is to call execute().
This method can be called by the Thread (or main function) if it must perform concurrent (non-XF related) tasks in addition.
When using this method start() must not be called.
Implemented in XFDispatcher.
|
pure virtual |
Adds event to the events queue.
Implemented in XFDispatcher.
|
pure virtual |
Adds a new timeout to be handled.
The dispatcher will forward the timeout information to the timeout manager which is responsible to handle all timeouts.
Implemented in XFDispatcher.
|
pure virtual |
Removes all timeouts corresponding the given parameters.
Implemented in XFDispatcher.