#pragma once /** * \file PacketDispatcher.h * \brief File containing the blitz::protocol::PacketDispatcher class */ #include #include #include namespace td { namespace protocol { class PacketHandler; /** * \class PacketDispatcher * \brief Class used to dispatch packets */ class PacketDispatcher : private NonCopyable { private: std::map> 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 td