1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-08 13:11:49 +00:00

Add Client/Server interfaces

This commit is contained in:
TuxSH 2018-11-05 11:56:20 +01:00 committed by Michael Scire
parent dffb233423
commit 9318ab10b2
3 changed files with 91 additions and 0 deletions

View file

@ -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{};
};
}

View file

@ -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{};
};
}

View file

@ -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{};
};
}