123 lines
3.0 KiB
C++
123 lines
3.0 KiB
C++
/*
|
|
* File: Application.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on November 10, 2011, 03:37 PM
|
|
*/
|
|
|
|
#include "Application.h"
|
|
|
|
#include "Moversight.h"
|
|
#include "Dispatcher.h"
|
|
#include "PeerDescription.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
#if OMNETPP
|
|
|
|
/**
|
|
* @brief Constructor
|
|
* @param m A reference to the moversight instance
|
|
*/
|
|
Application::Application(Moversight & m, std::string name) :
|
|
ObjectListener(name),
|
|
module(m),
|
|
dis(NULL),
|
|
candidatesIndex(0),
|
|
initApp(true) {
|
|
}
|
|
#else
|
|
|
|
Application::Application() : module(NULL), dis(NULL), candidatesIndex(0), initApp(true) {
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* @brief Destructor
|
|
*/
|
|
Application::~Application() {
|
|
}
|
|
|
|
/**
|
|
* @brief Assignment operator.
|
|
* @param Application to copy.
|
|
*/
|
|
Application &
|
|
Application::operator =(const Application& other) {
|
|
|
|
if (this != &other) {
|
|
setServiceName(other.getServiceName());
|
|
module = other.module;
|
|
dis = other.dis;
|
|
candidates = other.candidates;
|
|
candidatesIndex = other.candidatesIndex;
|
|
initApp = other.initApp;
|
|
}//End if
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Sets the dispatcher call back to the test application.
|
|
*
|
|
* This method sets the dispatcher call back at the current test application instance.
|
|
* It is important to run this method before the testcase itself is executed.
|
|
* @param d The dispatcher to set.
|
|
*/
|
|
void
|
|
Application::setDispatcher(Dispatcher * d) {
|
|
dis = d;
|
|
}
|
|
|
|
void
|
|
Application::initialise() {
|
|
}
|
|
|
|
void
|
|
Application::finalise() {
|
|
}
|
|
|
|
#if UBEEME
|
|
|
|
void
|
|
Application::setMoversight(Moversight * m) {
|
|
module = m;
|
|
}
|
|
#endif
|
|
|
|
|
|
#if OMNETPP
|
|
|
|
/**
|
|
* @brief Callback method. This method is called by moversight to signal that the local peer have receive a group data message.
|
|
* @param data The received group data.
|
|
* @param sender The sending peer ID.
|
|
*/
|
|
void
|
|
Application::receiveGroupData(const GroupData & /* data */, const PeerID /* sender */) {
|
|
}
|
|
|
|
/**
|
|
* @brief Called, have the local peer received a stream data message.
|
|
* @param data The received message.
|
|
* @param sender The sender of the message.
|
|
*/
|
|
void
|
|
Application::receiveStreamMessage(const StreamMessage & /* data */, const PeerID /* sender */) {
|
|
}
|
|
|
|
/**
|
|
* @brief Called, have the local peer receive a stream data message.
|
|
* @param data The received message.
|
|
* @param sender The sender of the message.
|
|
*/
|
|
void
|
|
Application::receiveUnicastMessage(const UnicastMessage & /* data */, const PeerID /* sender */) {
|
|
}
|
|
|
|
#endif // #if OMNETPP
|
|
}
|
|
}
|