#pragma once /** * \file PacketDispatcher.h * \brief File containing the sp::protocol::PacketDispatcher class */ #include #include #include namespace sp { namespace protocol { /** * \class Dispatcher * \brief Class used to dispatch things */ template class Dispatcher : private NonCopyable { private: std::map> m_Handlers; public: /** * \brief Constructor */ Dispatcher() {} /** * \brief Dispatch a packet * \param packet The packet to dispatch */ void Dispatch(const T& packet); /** * \brief Register a packet handler * \param type The packet type * \param handler The packet handler */ void RegisterHandler(T_Enum type, T_Handler& handler); /** * \brief Unregister a packet handler * \param type The packet type * \param handler The packet handler */ void UnregisterHandler(T_Enum type, T_Handler& handler); /** * \brief Unregister a packet handler * \param handler The packet handler */ void UnregisterHandler(T_Handler& handler); }; } // namespace protocol } // namespace sp #include "Dispatcher.inl"