mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #310, used empty network context with runtime/context base classes
* refactored to member initialization * adjusted asserts * adjusted isXXObject methods * changed create method for ContextNetwork to support empty context * empty status message used as return value in empty context
This commit is contained in:
@@ -10,22 +10,24 @@
|
||||
#include "context_network.h"
|
||||
#include "context_network_impl.h"
|
||||
#include "context_network_proxy.h"
|
||||
#include "context_network_empty.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
IContextNetwork *IContextNetwork::create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn)
|
||||
IContextNetwork *IContextNetwork::create(CRuntime *runtime, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case CRuntimeConfig::Local:
|
||||
case CRuntimeConfig::LocalInDbusServer:
|
||||
return (new CContextNetwork(mode, parent))->registerWithDBus(server);
|
||||
return (new CContextNetwork(mode, runtime))->registerWithDBus(server);
|
||||
case CRuntimeConfig::Remote:
|
||||
return new BlackCore::CContextNetworkProxy(BlackCore::CDBusServer::ServiceName, conn, mode, parent);
|
||||
return new BlackCore::CContextNetworkProxy(BlackCore::CDBusServer::ServiceName, conn, mode, runtime);
|
||||
case CRuntimeConfig::NotUsed:
|
||||
default:
|
||||
return nullptr; // network not mandatory
|
||||
return new BlackCore::CContextNetworkEmpty(true, runtime);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namesapce
|
||||
|
||||
Reference in New Issue
Block a user