Files
scandocs/uni/masterarbeit/source/moversight/ut/timer/UnicastMessageRetransmitTimer.cc
2014-06-30 13:58:10 +02:00

96 lines
2.7 KiB
C++

/*
* File: UNICASTMESSAGERETRANSMITTIMER_H.cc
* Author: jgaebler
*
* Created on October 29, 2012, 12:02 PM
*/
#include "UnicastMessageRetransmitTimer.h"
#include "ut/UnicastTransfer.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Constructor
* @param t A reference to the unicast tranfer service
*/
UnicastMessageRetransmitTimer::UnicastMessageRetransmitTimer(UnicastTransfer & ut) : ReferenceTimer<MessageReference>(ut) {
#if OMNETPP
setName("UnicastMessageRetransmitTimer");
#endif
GenericTime t(UT_RETRANSMIT_TIMEOUT);
setTimeout(t);
}
/**
* @brief Copy constructor
* @param orig The instance to copy
*/
UnicastMessageRetransmitTimer::UnicastMessageRetransmitTimer(const UnicastMessageRetransmitTimer& orig) : ReferenceTimer<MessageReference>(orig) {
operator =(orig);
}
/**
* @brief Destructor
*/
UnicastMessageRetransmitTimer::~UnicastMessageRetransmitTimer() {
}
/**
* @brief If the timer is fired, this method is called and the timer
* handled.
*/
void
UnicastMessageRetransmitTimer::timeout() {
dynamic_cast<UnicastTransfer&> (service).handleTimeout(this);
}
/**
* @brief Duplicates the timer.
* @return A reference to the local instance.
*/
UnicastMessageRetransmitTimer *
UnicastMessageRetransmitTimer::dup() {
return new UnicastMessageRetransmitTimer(*this);
}
/**
* @brief Returns the source of message, monitored by this timer.
* @return The source of the message to monitor
*/
TransportAddress
UnicastMessageRetransmitTimer::getSource() {
return storage.get<TransportAddress>("sourceTA");
}
/**
* @brief Sets the source of the message to monitor
* @param ta The source address of the message to monitor.
*/
void
UnicastMessageRetransmitTimer::setSource(const TransportAddress & ta) {
storage.set<TransportAddress>("sourceTA", ta);
}
/**
* @brief Assignment operator
* @param other The instance to assign
* @return A reference to the local instance.
*/
UnicastMessageRetransmitTimer &
UnicastMessageRetransmitTimer::operator =(const UnicastMessageRetransmitTimer& other) {
if (this == &other) return *this;
ReferenceTimer<MessageReference>::operator =(other);
return *this;
}
}
}