diff --git a/mesosphere/include/mesosphere/interfaces/IClient.hpp b/mesosphere/include/mesosphere/interfaces/IClient.hpp new file mode 100644 index 000000000..ed737f0cb --- /dev/null +++ b/mesosphere/include/mesosphere/interfaces/IClient.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +namespace mesosphere +{ + +template +class IClient { + public: + using ParentType = Parent; + using ClientType = Client; + using ServerType = Server; + + ~IClient() + { + parent->HandleClientDestroyed(); + } + + protected: + void Initialize(SharedPtr parent) + { + this->parent = std::move(parent); + } + + SharedPtr parent{}; +}; + +} \ No newline at end of file diff --git a/mesosphere/include/mesosphere/interfaces/IClientServerParent.hpp b/mesosphere/include/mesosphere/interfaces/IClientServerParent.hpp new file mode 100644 index 000000000..b82feb716 --- /dev/null +++ b/mesosphere/include/mesosphere/interfaces/IClientServerParent.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +namespace mesosphere +{ + +template +class IClientServerParent { + public: + using ParentType = Parent; + using ClientType = Client; + using ServerType = Server; + + protected: + void Initialize() + { + Parent par = (Parent *)this; + client.Initialize(par); + server.Initialize(par); + } + + ClientType client{}; + ServerType server{}; +}; + +} diff --git a/mesosphere/include/mesosphere/interfaces/IServer.hpp b/mesosphere/include/mesosphere/interfaces/IServer.hpp new file mode 100644 index 000000000..5a81b0da8 --- /dev/null +++ b/mesosphere/include/mesosphere/interfaces/IServer.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include + +namespace mesosphere +{ + +template +class IServer { + public: + using ParentType = Parent; + using ClientType = Client; + using ServerType = Server; + + ~IServer() + { + parent->HandleServerDestroyed(); + } + + protected: + void Initialize(SharedPtr parent) + { + this->parent = std::move(parent); + this->client = &this->parent->client; + } + + SharedPtr parent{}; + SharedPtr client{}; +}; + +} \ No newline at end of file