69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
/*
|
|
* File: OGTTimer.cc
|
|
* Author: jgaebler
|
|
*
|
|
* Created on May 20, 2010, 10:39 AM
|
|
*/
|
|
|
|
#include "GTTimer.h"
|
|
|
|
#include "mt/MessageTransfer.h"
|
|
#include "Moversight.h"
|
|
#include "Dispatcher.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Creates a GT Timer (type = GT_TIMER, name= gtTimer, timeout= gtTimeout)
|
|
*/
|
|
GTTimer::GTTimer(MessageTransfer & aMt) : MTTimer(aMt) {
|
|
#if OMNETPP
|
|
setName("gtTimer");
|
|
#endif
|
|
GenericTime t(GT_TIMEOUT);
|
|
setTimeout(t);
|
|
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor
|
|
*/
|
|
GTTimer::~GTTimer() {
|
|
mt.timerQueue.remove(getReference());
|
|
}
|
|
|
|
/**
|
|
* @brief A duplicate method. Duplicates the current timer.
|
|
* @return A referenze to the new created timer.
|
|
*/
|
|
MTTimer*
|
|
GTTimer::dup() {
|
|
return new GTTimer(*this);
|
|
}
|
|
|
|
/**
|
|
* @brief If the timer is fired, this method is called and the timer
|
|
* handled.
|
|
*/
|
|
void
|
|
GTTimer::timeout() {
|
|
mt.handleGTTimer(this);
|
|
}
|
|
|
|
/**
|
|
* @brief Starts the timer.
|
|
*/
|
|
void
|
|
GTTimer::start() {
|
|
|
|
if (!mt.timerQueue.contains(getReference())) {
|
|
mt.timerQueue.add(this);
|
|
}
|
|
|
|
MoversightTimer::start();
|
|
}
|
|
}
|
|
}
|
|
|