diff --git a/src/simplified/xf/core/behavior.cpp b/src/simplified/xf/core/behavior.cpp index a1cc9e9..fcc930f 100644 --- a/src/simplified/xf/core/behavior.cpp +++ b/src/simplified/xf/core/behavior.cpp @@ -4,7 +4,6 @@ #include "xf/behavior.h" #include "trace/trace.h" -// TODO done: Implement code for XFBehavior class XFBehavior::XFBehavior() { this->deleteOnTerminate_ = false; diff --git a/src/simplified/xf/core/customevent.cpp b/src/simplified/xf/core/customevent.cpp index 85637e0..3f508cb 100644 --- a/src/simplified/xf/core/customevent.cpp +++ b/src/simplified/xf/core/customevent.cpp @@ -1,7 +1,5 @@ #include "xf/customevent.h" -// TODO done: Implement code for XFCustomEvent class - XFCustomEvent::XFCustomEvent(int id, interface::XFBehavior *pBehavior): XFEvent(XFEventType::Event, id){ diff --git a/src/simplified/xf/core/defaulttransition.cpp b/src/simplified/xf/core/defaulttransition.cpp index e08e854..73b4b30 100644 --- a/src/simplified/xf/core/defaulttransition.cpp +++ b/src/simplified/xf/core/defaulttransition.cpp @@ -1,7 +1,5 @@ #include "xf/defaulttransition.h" -// TODO done: Implement code for XFDefaultTransition class - XFDefaultTransition::XFDefaultTransition(): XFEvent(XFEventType::DefaultTransition) { diff --git a/src/simplified/xf/core/initialevent.cpp b/src/simplified/xf/core/initialevent.cpp index d7f343b..3fc3e8b 100644 --- a/src/simplified/xf/core/initialevent.cpp +++ b/src/simplified/xf/core/initialevent.cpp @@ -1,7 +1,5 @@ #include "xf/initialevent.h" -// TODO done: Implement code for XFInitialEvent class - XFInitialEvent::XFInitialEvent(): XFEvent(XFEventType::Initial) { diff --git a/src/simplified/xf/core/timeout.cpp b/src/simplified/xf/core/timeout.cpp index 264688a..f2a6d89 100644 --- a/src/simplified/xf/core/timeout.cpp +++ b/src/simplified/xf/core/timeout.cpp @@ -1,10 +1,7 @@ #include "xf/timeout.h" -// TODO done: Implement code for XFTimeout class - XFTimeout::XFTimeout(int id, int interval, interface::XFBehavior *pBehavior): XFEvent(XFEventType::Timeout, id), interval_(interval) { - this->setRelTicks(this->getInterval()); setBehavior(pBehavior); } diff --git a/src/simplified/xf/port/common/dispatcher.cpp b/src/simplified/xf/port/common/dispatcher.cpp index 6f3481b..9577a72 100644 --- a/src/simplified/xf/port/common/dispatcher.cpp +++ b/src/simplified/xf/port/common/dispatcher.cpp @@ -24,8 +24,6 @@ interface::XFDispatcher * interface::XFDispatcher::getInstance() { return &dispatcher; } -// TODO done: Implement code for XFDispatcher class - XFDispatcher::XFDispatcher() { this->pMutex_ = interface::XFMutex::create(); } @@ -35,7 +33,6 @@ XFDispatcher::~XFDispatcher() { } void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const { - //Trace::out("[DEBUG] - Dispatch Event"); XFBehavior::TerminateBehavior terminateBehavior; terminateBehavior = pEvent->getBehavior()->process(pEvent); if(terminateBehavior && pEvent->getBehavior()->deleteOnTerminate()) { @@ -47,7 +44,6 @@ void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const { } void XFDispatcher::pushEvent(XFEvent *pEvent) { - //Trace::out("[DEBUG] - Push Event"); this->pMutex_->lock(); events_.push(pEvent, false); this->pMutex_->unlock(); diff --git a/src/simplified/xf/port/common/timeoutmanager.cpp b/src/simplified/xf/port/common/timeoutmanager.cpp index a796485..f0d0e87 100644 --- a/src/simplified/xf/port/common/timeoutmanager.cpp +++ b/src/simplified/xf/port/common/timeoutmanager.cpp @@ -24,8 +24,6 @@ interface::XFTimeoutManager * interface::XFTimeoutManager::getInstance() { return &timeoutManager; } -// TODO done: Implement code for XFTimeoutManager class - XFTimeoutManager::XFTimeoutManager() { this->pMutex_ = interface::XFMutex::create(); } @@ -35,6 +33,17 @@ XFTimeoutManager::~XFTimeoutManager() { } void XFTimeoutManager::addTimeout(XFTimeout *pNewTimeout) { + + const int desireInterval = pNewTimeout->getInterval(); + + TimeoutList::iterator it; + do { + // TODO, super algorithm + } while (true); + + int ticks = pNewTimeout->getInterval() / this->tickInterval_; + pNewTimeout->setRelTicks(ticks); + this->pMutex_->lock(); this->timeouts_.push_back(pNewTimeout); this->pMutex_->unlock(); @@ -53,17 +62,11 @@ void XFTimeoutManager::start(std::function startTimeoutManagerT } void XFTimeoutManager::scheduleTimeout(int32_t timeoutId, int32_t interval, interface::XFBehavior *pBehavior) { - string str = "[DEBUG] - Schedule Timeout: "; - str += to_string(timeoutId); - //Trace::out(str); ::XFTimeout* timeout = new XFTimeout(timeoutId, interval, pBehavior); addTimeout(timeout); } void XFTimeoutManager::unscheduleTimeout(int32_t timeoutId, interface::XFBehavior *pBehavior) { - string str = "[DEBUG] - Unschedule Timeout: "; - str += to_string(timeoutId); - //Trace::out(str); this->pMutex_->lock(); TimeoutList::iterator it; for(it = this->timeouts_.begin(); it != this->timeouts_.end(); it++){