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

103 lines
2.9 KiB
C++

/*
* File: UnicastMessageConfirm.cc
* Author: jgaebler
*
* Created on October 30, 2012, 2:23 PM
*/
#include "UnicastMessageConfirm.h"
#include "Dispatcher.h"
#include "common/validator/MessageValidator.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Constructor
* @param mRef The message reference of the confirmed message.
*/
UnicastMessageConfirm::UnicastMessageConfirm( const MessageReference& mRef)
: ExteriorMessage( "UMC", UMC), messageReference(mRef) {
}
/**
* @brief Copy constructor
* @param orig The message to copy
*/
UnicastMessageConfirm::UnicastMessageConfirm(const UnicastMessageConfirm& other)
: ExteriorMessage( other) {
operator=( other);
}
/**
* @brief Destructor
*/
UnicastMessageConfirm::~UnicastMessageConfirm() {
}
/**
* @brief Delivers the message to the handling module.
* @param dis A reference to the dispatcher.
*/
void
UnicastMessageConfirm::handleReceive(Dispatcher & dis) {
//validate the message
if (dis.getMessageValidator()->isValid( *this)) {
dis.getUnicastTransfer().handleMessage(*this);
}
}
/**
* @brief Duplication method. Duplicates the current message by calling copy constructor.
* @return A reference to the duplicated message.
*/
UnicastMessageConfirm *
UnicastMessageConfirm::dup() const {
return new UnicastMessageConfirm(*this);
}
/**
* @brief Assignment operator.
* @param other The instance to assign.
* @return A reference to the local instance.
*/
UnicastMessageConfirm&
UnicastMessageConfirm::operator=( const UnicastMessageConfirm & other) {
ExteriorMessage::operator =(other);
messageReference = other.messageReference;
return *this;
}
/**
* @brief Sets the message reference of the message.
* @param mRef The message reference to set.
*/
void
UnicastMessageConfirm::setMessageReference( const MessageReference& mRef) {
messageReference = mRef;
}
/**
* @brief Permits access to the message reference of the message.
* @return The message reference of the message.
*/
const MessageReference&
UnicastMessageConfirm::getMessageReference() const {
return messageReference;
}
/**
* @brief Archives the message.
* @param archive The archive to which the attributes are to add
*/
void
UnicastMessageConfirm::set( Archive& archive) {
ExteriorMessage::set(archive);
archive(messageReference);
}
}
}