[raknet] Update RakNetworkFactory

This commit implements:
* GetRakClientInterface()
* DestroyRakClientInterface()
* DestroyRakServerInterface()
* DestroyRakPeerInterface()
This commit is contained in:
RD42 2023-12-16 23:25:47 +08:00
parent 68cd566ffc
commit 118153f727
2 changed files with 28 additions and 6 deletions

View File

@ -1,13 +1,16 @@
// TODO: Implement RakNetworkFactory.cpp
#include "RakNetworkFactory.h" #include "RakNetworkFactory.h"
#include "RakServerInterface.h" #include "RakServerInterface.h"
#include "RakClientInterface.h"
#include "RakServer.h" #include "RakServer.h"
#include "RakClient.h"
#include "RakPeerInterface.h" #include "RakPeerInterface.h"
#include "RakPeer.h" #include "RakPeer.h"
RakClientInterface* RakNetworkFactory::GetRakClientInterface( void )
{
return new RakClient;
}
RakServerInterface* RakNetworkFactory::GetRakServerInterface( void ) RakServerInterface* RakNetworkFactory::GetRakServerInterface( void )
{ {
return new RakServer; return new RakServer;
@ -15,4 +18,20 @@ RakServerInterface* RakNetworkFactory::GetRakServerInterface( void )
RakPeerInterface* RakNetworkFactory::GetRakPeerInterface( void ) RakPeerInterface* RakNetworkFactory::GetRakPeerInterface( void )
{ {
return new RakPeer; return new RakPeer;
} }
void RakNetworkFactory::DestroyRakClientInterface( RakClientInterface* i )
{
delete ( RakClient* ) i;
}
void RakNetworkFactory::DestroyRakServerInterface( RakServerInterface* i )
{
delete ( RakServer* ) i;
}
void RakNetworkFactory::DestroyRakPeerInterface( RakPeerInterface* i )
{
delete ( RakPeer* ) i;
}

View File

@ -1,11 +1,10 @@
// TODO: Implement RakNetworkFactory.h
#ifndef __RAK_NETWORK_FACTORY_H #ifndef __RAK_NETWORK_FACTORY_H
#define __RAK_NETWORK_FACTORY_H #define __RAK_NETWORK_FACTORY_H
#include "Export.h" #include "Export.h"
class RakClientInterface;
class RakServerInterface; class RakServerInterface;
class RakPeerInterface; class RakPeerInterface;
@ -13,9 +12,13 @@ class RAK_DLL_EXPORT RakNetworkFactory
{ {
public: public:
static RakClientInterface* GetRakClientInterface( void );
static RakServerInterface* GetRakServerInterface( void ); static RakServerInterface* GetRakServerInterface( void );
static RakPeerInterface* GetRakPeerInterface( void ); static RakPeerInterface* GetRakPeerInterface( void );
static void DestroyRakClientInterface( RakClientInterface* i );
static void DestroyRakServerInterface( RakServerInterface* i );
static void DestroyRakPeerInterface( RakPeerInterface* i );
}; };
#endif #endif