Simplified XF 1.1.0

timeoutmanager.h
1#ifndef XF_COMMON_TIMEOUTMANAGER_H
2#define XF_COMMON_TIMEOUTMANAGER_H
3
4#include <list>
5#include <config/xf-config.h>
6
7#if (USE_XF_COMMON_TIMEOUTMANAGER_CLASS != 0)
8
9#include "xf/interface/timeoutmanager.h"
10#include "xf/timeout.h"
11#include "xf/interface/mutex.h"
12
20 class XFTimeoutManager : public interface::XFTimeoutManager
21{
22 friend interface::XFTimeoutManager * interface::XFTimeoutManager::getInstance();
23 public:
24 ~XFTimeoutManager() override;
25
26 void start(std::function<void(uint32_t)> startTimeoutManagerTimer = nullptr) override;
27 void scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior * pBehavior) override;
28 void unscheduleTimeout(int32_t timeoutId, interface::XFBehavior * pBehavior) override;
29 void tick() override;
30
31 protected:
32 XFTimeoutManager();
33 void addTimeout(XFTimeout * pNewTimeout) override;
34
39 void returnTimeout(XFTimeout * pTimeout);
40
41 protected:
42 typedef std::list<XFTimeout *> TimeoutList;
43
44 TimeoutList timeouts_;
45
46 interface::XFMutex * pMutex_;
47};
48 // end of port_common group
50#endif // USE_XF_COMMON_TIMEOUTMANAGER_CLASS
51#endif // XF_COMMON_TIMEOUTMANAGER_H
XFTimeout
Used by the TimeoutManager to create and handle a timeout.
Definition: timeout.h:28
XFTimeoutManager
Default implementation of the XF TimeoutManager.
Definition: timeoutmanager.h:21
XFTimeoutManager::TimeoutList
std::list< XFTimeout * > TimeoutList
Type used for the _timeouts property.
Definition: timeoutmanager.h:42
XFTimeoutManager::start
void start(std::function< void(uint32_t)> startTimeoutManagerTimer=nullptr) override
See interface::XFTimeoutManager.
XFTimeoutManager::addTimeout
void addTimeout(XFTimeout *pNewTimeout) override
Adds the timeout to timeouts_.
XFTimeoutManager::tick
void tick() override
See interface::XFTimeoutManager.
XFTimeoutManager::pMutex_
interface::XFMutex * pMutex_
Mutex to protect access to TimeoutList.
Definition: timeoutmanager.h:46
XFTimeoutManager::unscheduleTimeout
void unscheduleTimeout(int32_t timeoutId, interface::XFBehavior *pBehavior) override
See interface::XFTimeoutManager.
XFTimeoutManager::returnTimeout
void returnTimeout(XFTimeout *pTimeout)
Returns timeout back to behavioral class.
XFTimeoutManager::scheduleTimeout
void scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior *pBehavior) override
See interface::XFTimeoutManager.
XFTimeoutManager::timeouts_
TimeoutList timeouts_
Container holding timeouts to manage.
Definition: timeoutmanager.h:44
interface::XFBehavior
Interface to receive and process events.
Definition: behavior.h:24
interface::XFMutex
Mutex interface needed by the XF to access a mutex.
Definition: mutex.h:18
interface::XFTimeoutManager
Interface for TimerManager classes (and some few 'tick' stuff already provided).
Definition: timeoutmanager.h:26
interface::XFTimeoutManager::getInstance
static XFTimeoutManager * getInstance()
Returns a pointer to the single instance of TimeoutManager.
Definition: timeoutmanager.cpp:18