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:
parent
dffb233423
commit
9318ab10b2
3 changed files with 91 additions and 0 deletions
31
mesosphere/include/mesosphere/interfaces/IClient.hpp
Normal file
31
mesosphere/include/mesosphere/interfaces/IClient.hpp
Normal 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{};
|
||||
};
|
||||
|
||||
}
|
|
@ -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{};
|
||||
};
|
||||
|
||||
}
|
33
mesosphere/include/mesosphere/interfaces/IServer.hpp
Normal file
33
mesosphere/include/mesosphere/interfaces/IServer.hpp
Normal 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{};
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue