#pragma once #include "tcp_server.hpp" #include "service_server.hpp" #include "../service.hpp" namespace demonware { class lobby_server : public tcp_server, service_server { public: lobby_server(std::string name); template void register_service() { static_assert(std::is_base_of::value, "service must inherit from service"); auto service = std::make_unique(); const uint8_t id = service->id(); this->services_[id] = std::move(service); } void send_reply(reply* data) override; private: std::unordered_map> services_; void handle(const std::string& packet) override; void call_service(uint8_t id, const std::string& data); }; }