update20140630
This commit is contained in:
76
uni/masterarbeit/source/moversight/mt/timer/GarbageTimer.cc
Normal file
76
uni/masterarbeit/source/moversight/mt/timer/GarbageTimer.cc
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user