From 381b6505b5afaacc9194168697f6bc93c43d2775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 6 Jan 2021 21:52:53 +0100 Subject: Access services via Server object --- include/erebos/network.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/erebos/network.h') diff --git a/include/erebos/network.h b/include/erebos/network.h index d730fb5..a2f989e 100644 --- a/include/erebos/network.h +++ b/include/erebos/network.h @@ -4,6 +4,7 @@ #include #include +#include namespace erebos { @@ -13,14 +14,24 @@ public: Server(const Identity &, std::vector> &&); ~Server(); + template S & svc(); + class PeerList & peerList() const; struct Peer; private: + Service & svcHelper(const std::type_info &); + struct Priv; const std::shared_ptr p; }; +template +S & Server::svc() +{ + return dynamic_cast(svcHelper(typeid(S))); +} + class Peer { public: -- cgit v1.2.3