63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
#include "GTAwaitTimer.h"
|
|
|
|
#include "mt/MessageTransfer.h"
|
|
#include "Moversight.h"
|
|
#include "Dispatcher.h"
|
|
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Creates a GTAwait Timer (type = GT_AWAIT_TIMER, name= gtAwaitTimer, timeout= gtAwaitTimeout)
|
|
* @param aMt a reference to the message transfer instance
|
|
*/
|
|
GTAwaitTimer::GTAwaitTimer(MessageTransfer & aMt) : MTTimer(aMt) {
|
|
#if OMNETPP
|
|
setName("gtAwaitTimer");
|
|
#endif
|
|
GenericTime t(GT_AWAIT_TIMEOUT);
|
|
setTimeout(t);
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor
|
|
*/
|
|
GTAwaitTimer::~GTAwaitTimer() {
|
|
mt.gtAwaitTimerQueue.remove(getReference());
|
|
}
|
|
|
|
/**
|
|
* @brief A duplicate method. Duplicates the current timer.
|
|
* @return A reference to the new created timer.
|
|
*/
|
|
MTTimer*
|
|
GTAwaitTimer::dup() {
|
|
return new GTAwaitTimer(*this);
|
|
}
|
|
|
|
/**
|
|
* @brief If the timer is fired, this method is called and the timer
|
|
* handled.
|
|
*/
|
|
void
|
|
GTAwaitTimer::timeout(){
|
|
mt.handleGTAwaitTimer(this);
|
|
}
|
|
|
|
/**
|
|
* @brief Starts the timer.
|
|
*/
|
|
void
|
|
GTAwaitTimer::start() {
|
|
|
|
if(!mt.gtAwaitTimerQueue.contains(getReference())){
|
|
mt.gtAwaitTimerQueue.add(this);
|
|
}
|
|
|
|
MoversightTimer::start();
|
|
}
|
|
}
|
|
}
|
|
|