diff options
Diffstat (limited to 'include/erebos/network.h')
-rw-r--r-- | include/erebos/network.h | 11 |
1 files changed, 11 insertions, 0 deletions
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 <erebos/service.h> #include <functional> +#include <typeinfo> namespace erebos { @@ -13,14 +14,24 @@ public: Server(const Identity &, std::vector<std::unique_ptr<Service>> &&); ~Server(); + template<class S> S & svc(); + class PeerList & peerList() const; struct Peer; private: + Service & svcHelper(const std::type_info &); + struct Priv; const std::shared_ptr<Priv> p; }; +template<class S> +S & Server::svc() +{ + return dynamic_cast<S&>(svcHelper(typeid(S))); +} + class Peer { public: |