Files
2014-06-30 13:58:10 +02:00

74 lines
1.6 KiB
C++

/*
* File: LTTimer.cc
* Author: jgaebler
*
* Created on May 20, 2010, 10:39 AM
*/
#include "LTTimer.h"
#include "Moversight.h"
#include "mt/MessageTransfer.h"
#include "Dispatcher.h"
namespace ubeeme {
namespace moversight {
#undef DEBUG
#define DEBUG(msg) if (mt.module.isPrintDebugMT()) MOV_DEBUG << "MT@" << mt.getLocalID()<< " "<<msg<<endl;
/**
* @brief Creates a LT Timer (type = LT_TIMER, name= ltTimer, timeout= ltTimeout)
* @param aMt the message transfer instance which owns this timer
*/
LTTimer::LTTimer(MessageTransfer & aMt) : MTTimer(aMt) {
#if OMNETPP
setName("ltTimer");
#endif
GenericTime t(LT_TIMEOUT);
setTimeout(t);
}
/**
* @brief Destructor
*/
LTTimer::~LTTimer() {
mt.timerQueue.remove(getReference());
}
/**
* @brief A duplicate method. Duplicates the current timer.
* @return A reference to the new created timer.
*/
LTTimer*
LTTimer::dup() {
return new LTTimer(*this);
}
/**
* @brief If the timer is fired, this method is called and the timer
* handled.
*/
void
LTTimer::timeout() {
mt.handleLTTimer(this);
}
/**
* @brief Starts the timer.
*/
void
LTTimer::start() {
if (!mt.timerQueue.contains(getReference())) {
mt.timerQueue.add(this);
}//end if
MoversightTimer::start();
}
}
}