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

83 lines
2.0 KiB
C++

/*
* File: SplitAbortTimer.cc
* Author: sgaebler
* Author: jgaebler
*
* Created on May 24, 2011, 4:09 PM
*/
#include "SplitAbortTimer.h"
#include "MoversightTimerSettings.h"
#include "split/SplitService.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Constructor.
* @param aService A reference to the split service.
*/
SplitAbortTimer::SplitAbortTimer(SplitService & aService) : MoversightTimer(aService) {
#if OMNETPP
setName("SplitAbortTimer");
#endif
setNumberOfRetries(SPLIT_NUMBER_OF_MAX_RETRIES);
GenericTime t(SPLIT_ABORT_TIMEOUT);
setTimeout(t);
}
/**
* @brief Destructor
*/
SplitAbortTimer::~SplitAbortTimer() {
}
/**
* @brief If the timer is fired, this method is called and the timer
* handled.
*/
void
SplitAbortTimer::timeout() {
dynamic_cast<SplitService&> (service).handleSplitAbortTimer(this);
}
/**
* @brief Sets the split operation to store.
* @param sp The split operation to store.
*/
void
SplitAbortTimer::setSplit(SplitOperation & sp) {
storage.set<SplitOperation>("sp", sp);
}
/**
* @brief Permits access to the stored split operation.
* @return The stored split operation.
*/
SplitOperation
SplitAbortTimer::getSplit() {
return storage.get<SplitOperation>("sp");
}
/**
* @brief Creates a copy of the current instance.
* @return The desired copy.
*/
SplitAbortTimer *
SplitAbortTimer::dup() {
return new SplitAbortTimer(*this);
}
/**
* @brief Starts the timer.
*/
void
SplitAbortTimer::start() {
dynamic_cast<SplitService&> (service).splitAbortTimer = this;
MoversightTimer::start();
}
}
}