45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#ifndef GROUP_MESSAGE_FACTORY_H
|
|
#define GROUP_MESSAGE_FACTORY_H
|
|
|
|
#include "core/network/message_validator.h"
|
|
|
|
#include "common/Defines.h"
|
|
|
|
#include "GroupMessage.h"
|
|
|
|
namespace ubeeme
|
|
{
|
|
namespace moversight
|
|
{
|
|
class MOV_EXPORT GroupMessageFactory : public ubeeme::MessageValidator<PeerID>
|
|
{
|
|
public:
|
|
virtual ~GroupMessageFactory();
|
|
|
|
/**
|
|
* @brief Creates a message out of the given buffer and the PeerID the message was received from.
|
|
* @param buffer Buffer the message should created of.
|
|
* @param from PeerID the message was reiceved from.
|
|
* @returns The created message.
|
|
*/
|
|
QSharedPointer<GroupMessage> createMessage(ByteArray const &buffer, PeerID const &from);
|
|
|
|
protected:
|
|
/**
|
|
* @brief Creates the concrete message by given message type and buffer.
|
|
* @param messageType The type of message in the scope a module.
|
|
* @param buffer Buffer the message should created of.
|
|
* @param size Size of the buffer to use for deserialization.
|
|
* @returns The created message.
|
|
* @note Use the deserializePayload method of network message to deserialize the concreate message.
|
|
*/
|
|
virtual QSharedPointer<GroupMessage> internalCreateMessage(int messageType, char const *buffer, int size) = 0;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // GROUP_MESSAGE_FACTORY_H
|
|
|