/* Blinker
Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#include <map>
#include <set>
#include "CallMgr.h"
#include "Time.h"
#include "TimeCallee.h"
namespace Blinker {
/// constructor
CallMgr::CallMgr()
{
}
/// destructor
CallMgr::~CallMgr()
{
}
/**
* @brief cancel callback at certain time
* @param[in] callee whom not to call
*/
void CallMgr::cancelTimeCall(TimeCallee *callee)
{
// find time a call is registered at
TimeCalleeMap::iterator itCallee;
itCallee = m_timeCallees.find(callee);
if (itCallee == m_timeCallees.end())
return; // no call registered
const Time &time = itCallee->second;
// remove registered call
m_times[time].erase(callee);
m_timeCallees.erase(itCallee);
}
/**
* @brief request callback at certain time
* @param[in] callee whom to call
* @param[in] time when to call
*
* this cancels a previous time call request from callee
*/
void CallMgr::requestTimeCall(TimeCallee *callee, const Time &time)
{