From 118153f727bcae0d414bcc819fb21370f225f5f7 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 16 Dec 2023 23:25:47 +0800 Subject: [PATCH] [raknet] Update RakNetworkFactory This commit implements: * GetRakClientInterface() * DestroyRakClientInterface() * DestroyRakServerInterface() * DestroyRakPeerInterface() --- raknet/RakNetworkFactory.cpp | 27 +++++++++++++++++++++++---- raknet/RakNetworkFactory.h | 7 +++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/raknet/RakNetworkFactory.cpp b/raknet/RakNetworkFactory.cpp index 45e53d4..115798b 100644 --- a/raknet/RakNetworkFactory.cpp +++ b/raknet/RakNetworkFactory.cpp @@ -1,13 +1,16 @@ -// TODO: Implement RakNetworkFactory.cpp #include "RakNetworkFactory.h" #include "RakServerInterface.h" - +#include "RakClientInterface.h" #include "RakServer.h" - +#include "RakClient.h" #include "RakPeerInterface.h" #include "RakPeer.h" +RakClientInterface* RakNetworkFactory::GetRakClientInterface( void ) +{ + return new RakClient; +} RakServerInterface* RakNetworkFactory::GetRakServerInterface( void ) { return new RakServer; @@ -15,4 +18,20 @@ RakServerInterface* RakNetworkFactory::GetRakServerInterface( void ) RakPeerInterface* RakNetworkFactory::GetRakPeerInterface( void ) { return new RakPeer; -} \ No newline at end of file +} + + + + +void RakNetworkFactory::DestroyRakClientInterface( RakClientInterface* i ) +{ + delete ( RakClient* ) i; +} +void RakNetworkFactory::DestroyRakServerInterface( RakServerInterface* i ) +{ + delete ( RakServer* ) i; +} +void RakNetworkFactory::DestroyRakPeerInterface( RakPeerInterface* i ) +{ + delete ( RakPeer* ) i; +} diff --git a/raknet/RakNetworkFactory.h b/raknet/RakNetworkFactory.h index 6a0f503..3b68df7 100644 --- a/raknet/RakNetworkFactory.h +++ b/raknet/RakNetworkFactory.h @@ -1,11 +1,10 @@ -// TODO: Implement RakNetworkFactory.h - #ifndef __RAK_NETWORK_FACTORY_H #define __RAK_NETWORK_FACTORY_H #include "Export.h" +class RakClientInterface; class RakServerInterface; class RakPeerInterface; @@ -13,9 +12,13 @@ class RAK_DLL_EXPORT RakNetworkFactory { public: + static RakClientInterface* GetRakClientInterface( void ); static RakServerInterface* GetRakServerInterface( void ); static RakPeerInterface* GetRakPeerInterface( void ); + static void DestroyRakClientInterface( RakClientInterface* i ); + static void DestroyRakServerInterface( RakServerInterface* i ); + static void DestroyRakPeerInterface( RakPeerInterface* i ); }; #endif