timeoutmanager.h
#ifndef XF_COMMON_TIMEOUTMANAGER_H
#define XF_COMMON_TIMEOUTMANAGER_H
#include <list>
#include <config/xf-config.h>
#if (USE_XF_COMMON_TIMEOUTMANAGER_CLASS != 0)
#include "xf/interface/timeoutmanager.h"
#include "xf/timeout.h"
#include "xf/interface/mutex.h"
class XFTimeoutManager : public interface::XFTimeoutManager
{
friend interface::XFTimeoutManager * interface::XFTimeoutManager::getInstance();
public:
~XFTimeoutManager() override;
void start(std::function<void(uint32_t)> startTimeoutManagerTimer = nullptr) override;
void scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior * pBehavior) override;
void unscheduleTimeout(int32_t timeoutId, interface::XFBehavior * pBehavior) override;
void tick() override;
protected:
XFTimeoutManager();
void addTimeout(XFTimeout * pNewTimeout) override;
void returnTimeout(XFTimeout * pTimeout);
protected:
typedef std::list<XFTimeout *> TimeoutList;
TimeoutList timeouts_;
interface::XFMutex * pMutex_;
};
// end of port_common group
#endif // USE_XF_COMMON_TIMEOUTMANAGER_CLASS
#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