81 lines
2.3 KiB
C++
81 lines
2.3 KiB
C++
/*
|
|
* File: MulticastMessageDelivered.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on March 5, 2014, 3:39 PM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef MULTICASTMESSAGEDELIVERED_H
|
|
#define MULTICASTMESSAGEDELIVERED_H
|
|
|
|
#include "MulticastMessageEvent.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class MulticastMessage;
|
|
|
|
/**
|
|
* @brief Event: A multicast message has been delivered.
|
|
* @note The event owns a copy of that message!
|
|
* @class MulticastMessageDelivered
|
|
* @author Jan Gäbler
|
|
* @ingroup Moversight
|
|
*/
|
|
class MulticastMessageDeliveredEvent : public MulticastMessageEventGroup<MulticastMessageDeliveredEvent> {
|
|
public:
|
|
|
|
/**
|
|
* @brief Constructor
|
|
* @param msg A copy of the message causing that event, will be
|
|
* delete by destroying this event.
|
|
* @note The message have to be a copy of the original one!
|
|
*/
|
|
MulticastMessageDeliveredEvent(MulticastMessage * msg) : message(msg) {
|
|
}
|
|
|
|
/**
|
|
* @brief Copy constructor
|
|
* @param orig The instance to copy
|
|
*/
|
|
MulticastMessageDeliveredEvent(const MulticastMessageDeliveredEvent & orig) : message(orig.message->dup()) {
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor
|
|
* @note Deletes also the message!
|
|
*/
|
|
virtual ~MulticastMessageDeliveredEvent(){
|
|
delete message;
|
|
}
|
|
|
|
/**
|
|
* @brief Returns the message causing this event.
|
|
* @return The message causing this event.
|
|
*/
|
|
virtual const MulticastMessage & getMessage() const {
|
|
return *message;
|
|
}
|
|
|
|
/**
|
|
* @brief Returns a string representation of the current instance.
|
|
*/
|
|
std::string toString() const {
|
|
std::stringstream buf;
|
|
buf << "MulticastMessageDeliveredEvent ["
|
|
<< "MessageReference: "
|
|
<< message->getMessageReference()
|
|
<< "]";
|
|
return buf.str();
|
|
}
|
|
|
|
private:
|
|
|
|
MulticastMessage * message;
|
|
};
|
|
}
|
|
}
|
|
#endif /* MULTICASTMESSAGEDELIVERED_H */
|
|
|