Simplified XF 1.1.0

eventqueue.h
1#ifndef XF_EVENT_QUEUE_DEFAULT_QT_H
2#define XF_EVENT_QUEUE_DEFAULT_QT_H
3
4#include "config/xf-config.h"
5
6#if (USE_XF_IDF_QT_EVENT_QUEUE_CLASS != 0)
7
8#include <stdint.h>
9#include <QMutex>
10#include <QWaitCondition>
11#include <QQueue>
12#include "xf/interface/eventqueue.h"
13
21 class XFEventQueue : public interface::XFEventQueue
22{
23 public:
24 XFEventQueue();
25 ~XFEventQueue() override;
26
27 // XFEventQueue interface implementation
28 public:
29 bool empty() const override;
30 bool push(const XFEvent * pEvent, bool fromISR = false) override;
31 const XFEvent * front() override;
32 void pop() override;
33 bool pend() override;
34
35 protected:
36 typedef QQueue<const XFEvent *> EventQueue;
37
38 QMutex mutex_;
39 QWaitCondition newEvents_;
40 EventQueue queue_;
41};
42 // end of port_idf_qt group
44#endif // USE_XF_IDF_QT_EVENT_QUEUE_CLASS
45#endif // XF_EVENT_QUEUE_DEFAULT_QT_H
XFEvent
Base class for all types of events and timeouts.
Definition: event.h:23
XFEventQueue
Default Qt implementation for the XFEventQueue interface.
Definition: eventqueue.h:22
XFEventQueue::empty
bool empty() const override
Returns true if no event is in the queue.
Definition: eventqueue.cpp:19
XFEventQueue::newEvents_
QWaitCondition newEvents_
Wait condition to let thread wait until a new event arrives.
Definition: eventqueue.h:39
XFEventQueue::queue_
EventQueue queue_
Internal queue holding the events.
Definition: eventqueue.h:40
XFEventQueue::pop
void pop() override
Pops the next event from the queue.
Definition: eventqueue.cpp:39
XFEventQueue::pend
bool pend() override
Wait for the next event to arrive. Returns true if an event is in the queue.
Definition: eventqueue.cpp:45
XFEventQueue::mutex_
QMutex mutex_
Mutex (non-recursive) protecting access to _queue.
Definition: eventqueue.h:38
XFEventQueue::front
const XFEvent * front() override
Returns pointer to next event to pop.
Definition: eventqueue.cpp:34
XFEventQueue::push
bool push(const XFEvent *pEvent, bool fromISR=false) override
Pushes the given event onto the queue. Returns false if the event could not be pushed.
Definition: eventqueue.cpp:24
XFEventQueue::EventQueue
QQueue< const XFEvent * > EventQueue
Type of the event queue.
Definition: eventqueue.h:36
interface::XFEventQueue
Interface to be implemented by the event queue.
Definition: eventqueue.h:12