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

126 lines
3.2 KiB
C++

#include "JoinAbort.h"
#include "Dispatcher.h"
#include "common/validator/MessageValidator.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Constructor
*/
JoinAbort::JoinAbort() : ExteriorMessage("JAB", JAB) {
}
/**
* @brief Copy constructor
* @param other The instance to copy
*/
JoinAbort::JoinAbort(const JoinAbort & other) : ExteriorMessage(other) {
operator=(other);
}
/**
* @brief Destructor
*/
JoinAbort::~JoinAbort() {
}
/**
* @brief Copy method. Creates a copy of the current instance.
* @return The copy of the current instance.
*/
JoinAbort *
JoinAbort::dup() const {
return new JoinAbort(*this);
}
/**
* @brief Handles this message. To handle a message, it has first successfully validated.
* @param dis A reference to the dispatcher, used to forward this message to the handling modules.
*/
void
JoinAbort::handleReceive(Dispatcher& dis) {
if (dis.getMessageValidator()->isValid(*this)) {
dis.getMembershipService().handleJoinAbort(this);
}//End if
}
/**
* @brief Assignment operator
* @param other The instance to assign
* @return a reference to this instance
*/
JoinAbort&
JoinAbort::operator=(const JoinAbort& other) {
if (this == &other) return *this;
ExteriorMessage::operator=(other);
invitationID = other.invitationID;
jabMessage = other.jabMessage;
return *this;
}
/**
* @brief Gets the invitationID
* @return the InvitationID
*/
InvitationID&
JoinAbort::getInvitationID(){
return invitationID;
}
/**
* @brief Gets the invitationID
* @return the InvitationID
*/
const InvitationID&
JoinAbort::getInvitationID() const {
return const_cast<JoinAbort*> (this)->getInvitationID();
}
/**
* @brief Sets the InvitationID
* @param invitationID The invitationID to be set
*/
void
JoinAbort::setInvitationID(const InvitationID& invitationID) {
this->invitationID = invitationID;
}
/**
* @brief Gets the Joinabort message
* @return the message
*/
const std::string &
JoinAbort::getJabMessage() const {
return jabMessage;
}
/**
* @brief Sets the Joinabort message
* @param jabMessage The joinabort message
*/
void
JoinAbort::setJabMessage(const std::string & jabMessage) {
this->jabMessage = jabMessage;
}
/**
* @brief Archive method
* @param archive The archive to which the attributes are to add
*/
void
JoinAbort::set(Archive & archive) {
ExteriorMessage::set(archive);
archive( invitationID);
archive( jabMessage);
}
}
}