Add Client/Server interfaces

This commit is contained in:
TuxSH authored and Michael Scire committed 2019-06-03 17:41:02 -07:00
1 parent dffb233423
commit 9318ab10b2
3 files changed
+91

No files matched your search

@@ -0,0 +1,31 @@
#pragma once
#include <utility>
#include <mesosphere/core/types.hpp>
#include <mesosphere/interfaces/IClientServerParent.hpp>
namespace mesosphere
{
template<typename Parent, typename Client, typename Server>
class IClient {
public:
using ParentType = Parent;
using ClientType = Client;
using ServerType = Server;
~IClient()
{
parent->HandleClientDestroyed();
}
protected:
void Initialize(SharedPtr<Parent> parent)
{
this->parent = std::move(parent);
}
SharedPtr<Parent> parent{};
};
}
@@ -0,0 +1,27 @@
#pragma once
#include <mesosphere/core/types.hpp>
namespace mesosphere
{
template<typename Parent, typename Client, typename Server>
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{};
};
}
@@ -0,0 +1,33 @@
#pragma once
#include <utility>
#include <mesosphere/core/types.hpp>
#include <mesosphere/interfaces/IClientServerParent.hpp>
namespace mesosphere
{
template<typename Parent, typename Client, typename Server>
class IServer {
public:
using ParentType = Parent;
using ClientType = Client;
using ServerType = Server;
~IServer()
{
parent->HandleServerDestroyed();
}
protected:
void Initialize(SharedPtr<Parent> parent)
{
this->parent = std::move(parent);
this->client = &this->parent->client;
}
SharedPtr<Parent> parent{};
SharedPtr<Client> client{};
};
}