Add copy / move to MessageDispatcher

This commit is contained in:
WarmUpTill 2025-04-07 20:40:24 +02:00 committed by WarmUpTill
parent 942933290a
commit 0fb11ac274

View File

@ -9,6 +9,27 @@ namespace advss {
template<class T> class MessageDispatcher {
public:
MessageDispatcher() = default;
~MessageDispatcher() = default;
MessageDispatcher(const MessageDispatcher &other)
: _clients(other._clients)
{
}
MessageDispatcher(MessageDispatcher &&other) noexcept
: _clients(other._clients)
{
}
MessageDispatcher<T> &operator=(const MessageDispatcher<T> &other)
{
_clients = other._clients;
return *this;
}
MessageDispatcher<T> &operator=(MessageDispatcher<T> &&other) noexcept
{
std::swap(_clients, other._clients);
return *this;
}
[[nodiscard]] std::shared_ptr<MessageBuffer<T>> RegisterClient();
void DispatchMessage(const T &message);