All checks were successful
Linux arm64 / Build (push) Successful in 4m59s
C'est très long Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com> Reviewed-on: #43 Co-authored-by: Persson-dev <sim16.prib@gmail.com> Co-committed-by: Persson-dev <sim16.prib@gmail.com>
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#pragma once
|
|
|
|
/**
|
|
* \file PacketDispatcher.h
|
|
* \brief File containing the blitz::protocol::PacketDispatcher class
|
|
*/
|
|
|
|
#include "blitz/common/NonCopyable.h"
|
|
#include "blitz/protocol/Protocol.h"
|
|
|
|
#include <map>
|
|
|
|
namespace blitz {
|
|
namespace protocol {
|
|
|
|
class PacketHandler;
|
|
|
|
/**
|
|
* \class PacketDispatcher
|
|
* \brief Class used to dispatch packets
|
|
*/
|
|
class PacketDispatcher : private NonCopyable {
|
|
private:
|
|
std::map<PacketType, std::vector<PacketHandler*>> m_Handlers;
|
|
|
|
public:
|
|
/**
|
|
* \brief Constructor
|
|
*/
|
|
PacketDispatcher() {}
|
|
|
|
/**
|
|
* \brief Dispatch a packet
|
|
* \param packet The packet to dispatch
|
|
*/
|
|
void Dispatch(const Packet* packet);
|
|
|
|
/**
|
|
* \brief Register a packet handler
|
|
* \param type The packet type
|
|
* \param handler The packet handler
|
|
*/
|
|
void RegisterHandler(PacketType type, PacketHandler* handler);
|
|
/**
|
|
* \brief Unregister a packet handler
|
|
* \param type The packet type
|
|
* \param handler The packet handler
|
|
*/
|
|
void UnregisterHandler(PacketType type, PacketHandler* handler);
|
|
/**
|
|
* \brief Unregister a packet handler
|
|
* \param handler The packet handler
|
|
*/
|
|
void UnregisterHandler(PacketHandler* handler);
|
|
};
|
|
|
|
} // namespace protocol
|
|
} // namespace blitz
|