Simplified XF 1.1.0
dispatcher.h
1#ifndef XF_COMMON_DISPATCHER_H
2#define XF_COMMON_DISPATCHER_H
3
4#include <config/xf-config.h>
5
6#if (USE_XF_COMMON_DISPATCHER_CLASS != 0)
7
8#include "xf/interface/dispatcher.h"
9#include "xf/interface/mutex.h"
10
11/*
12 * Please include the XFEventQueueDefault class in the xf-config file!
13 * Example: #include "default/eventqueue-default.h"
14 * and
15 * define the XFEventQueueDefault class as the class representing the
16 * XFEventQueue used by the dispatcher.
17 * Example: using XFEventQueue = XFEventQueueDefault;
18 *
19 * In case you want to provide you own event queue, you must implement
20 * your own XFEventQueue class and include the header file in the xf-config file.
21 */
22
36{
37 friend class interface::XFDispatcher;
38public:
39 virtual ~XFDispatcher();
40
41 void pushEvent(XFEvent * pEvent) override;
42
43 void scheduleTimeout(int timeoutId, int interval, interface::XFBehavior * pBehavior) override;
44 void unscheduleTimeout(int timeoutId, interface::XFBehavior * pBehavior) override;
45
46 void executeOnce() override;
47 int execute(const void * param = nullptr) override;
48
49protected:
50 XFDispatcher(); // Do not allow to create addition objects outside class space (singleton).
51 void dispatchEvent(const XFEvent * pEvent) const override;
52
53protected:
56};
57 // end of port_common group
59#endif // USE_XF_COMMON_DISPATCHER_CLASS
60#endif // XF_COMMON_DISPATCHER_H
Dispatcher used in an IDF (no underlying OS).
Definition: dispatcher.h:36
XFEventQueue events_
Queue holding events waiting to get dispatched.
Definition: dispatcher.h:54
void executeOnce() override
Executes once the dispatcher.
interface::XFMutex * pMutex_
Mutex to protect event queue.
Definition: dispatcher.h:55
void pushEvent(XFEvent *pEvent) override
Adds event to the events queue.
void unscheduleTimeout(int timeoutId, interface::XFBehavior *pBehavior) override
Removes all timeouts corresponding the given parameters.
void scheduleTimeout(int timeoutId, int interval, interface::XFBehavior *pBehavior) override
Adds a new timeout to be handled.
void dispatchEvent(const XFEvent *pEvent) const override
Dispatches the event to the corresponding behavioral part.
int execute(const void *param=nullptr) override
Main loop of the dispatcher. Implements event loop processing.
Base class for all types of events and timeouts.
Definition: event.h:23
Default Qt implementation for the XFEventQueue interface.
Definition: eventqueue.h:22
Interface to receive and process events.
Definition: behavior.h:24
Interface for the XF dispatcher providing the event processing loop.
Definition: dispatcher.h:29
Mutex interface needed by the XF to access a mutex.
Definition: mutex.h:18