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

77 lines
1.7 KiB
C++

/*
* File: OGarbageTimer.cc
* Author: jgaebler
*
* Created on May 26, 2010, 10:36 AM
*/
#include "GarbageTimer.h"
#include "mt/MessageTransfer.h"
#include "Moversight.h"
#include "Dispatcher.h"
#include "common/timer/MoversightTimer.h"
namespace ubeeme {
namespace moversight {
#undef DEBUG
#define DEBUG(msg) if (mt.module.isPrintDebugMT()) MOV_DEBUG << "MT@" << mt.getLocalID()<< " "<<msg<<endl;
/**
* @brief Creates a Garbage Timer (type = GARBAGE_TIMER, name= garbageTimer, timeout= garbageTimeout)
*/
GarbageTimer::GarbageTimer(MessageTransfer & aMt) : MTTimer(aMt) {
#if OMNETPP
setName("garbageTimer");
#endif
GenericTime t(GARBAGE_TIMEOUT);
setTimeout(t);
}
/**
* @brief Destructor
*/
GarbageTimer::~GarbageTimer() {
mt.timerQueue.remove(getReference());
}//End ~GTTimer
/**
* @brief A duplicate method. Duplicates the current timer.
* @return A reference to the new created timer.
*/
MTTimer*
GarbageTimer::dup() {
return new GarbageTimer(*this);
}
/**
* @brief If the timer is fired, this method is called and the timer
* handled.
*/
void
GarbageTimer::timeout() {
mt.handleGarbageTimer(this);
}
/**
* @brief Starts the timer.
*/
void
GarbageTimer::start() {
if (!mt.timerQueue.contains(getReference())) {
mt.timerQueue.add(this);
}//End if
MoversightTimer::start();
}//End start
}
}