Files
scandocs/uni/masterarbeit/source/moversight/common/timer/ReferenceMonitorTimer.h
2014-06-30 13:58:10 +02:00

108 lines
2.9 KiB
C++

/*
* File: ReferenceMonitorTimer.h
* Author: jgaebler
*
* Created on February 18, 2013, 10:09 AM
*/
#pragma once
#ifndef REFERENCEMONITORTIMER_H
#define REFERENCEMONITORTIMER_H
#include "ReferenceTimer.h"
#include "common/container/PeerIDList.h"
namespace ubeeme {
namespace moversight {
/**
* @class ReferenceMonitorTimer
* @author Jan Gäbler
* @brief Defines a reference timer that monitors a list of peers.
* @ingroup Moversight
*/
template <typename T>
class ReferenceMonitorTimer : public ReferenceTimer<T> {
public:
ReferenceMonitorTimer(MoversightService & aService);
ReferenceMonitorTimer(const ReferenceMonitorTimer<T>& orig);
virtual ~ReferenceMonitorTimer();
virtual void timeout() = 0;
ReferenceMonitorTimer<T> & operator=(const ReferenceMonitorTimer<T> & other);
virtual void setPeerIDList(PeerIDList peerList);
virtual PeerIDList getPeerIDList();
};
/**
* @brief Constructor
* @param service The service that owns that timer.
*/
template <typename T>
ReferenceMonitorTimer<T>::ReferenceMonitorTimer(MoversightService & aService) : ReferenceTimer<T>(aService) {
}
/**
* @brief Copy constructor
* @param orig The instance to copy
*/
template <typename T>
ReferenceMonitorTimer<T>::ReferenceMonitorTimer(const ReferenceMonitorTimer<T> & orig) : ReferenceTimer<T>(orig) {
operator=(orig);
}
/**
* @brief Destructor
*/
template <typename T>
ReferenceMonitorTimer<T>::~ReferenceMonitorTimer() {
}
/**
* @brief Sets the peer ids to monitor
* @param peerList The peer ids to monitor
*/
template <typename T>
void
ReferenceMonitorTimer<T>::setPeerIDList(PeerIDList peerList) {
MoversightTimer::storage.set<PeerIDList>("peerIDList", peerList);
}
/**
* @brief Returns the peer ids to monitor
* @return The peer ids to monitor.
*/
template <typename T>
PeerIDList
ReferenceMonitorTimer<T>::getPeerIDList() {
return MoversightTimer::storage.get<PeerIDList>("peerIDList");
}
/**
* @brief Assignment operator
* @param other The instance to copy
* @return A reference to the local instance.
*/
template <typename T>
ReferenceMonitorTimer<T> &
ReferenceMonitorTimer<T>::operator=(const ReferenceMonitorTimer<T> & other) {
if (this != &other) {
ReferenceTimer<T>::operator =(other);
}//End if
return *this;
}
}
}
#endif /* REFERENCEMONITORTIMER_H */