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:
Klaus Basan
2014-10-08 19:08:35 +02:00
parent dc173403fc
commit 9e23b0a2c0
7 changed files with 132 additions and 54 deletions

View File

@@ -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