mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 17:51:07 +00:00
* refactor: abstract connection/transport; and clearly separate qt remote obj and qt local into separate implementations * abstract qt remote registry * add mock implementation; these serves to further test the abstraction but also useful for testing modules later * use LogosObject instead of QObject * abstract provider side * updates to use new api * re-add async api back --------- Co-authored-by: Logos Workspace <logos@workspace.local>
33 lines
995 B
C++
33 lines
995 B
C++
#include "logos_transport_factory.h"
|
|
#include "logos_transport.h"
|
|
#include "logos_mode.h"
|
|
#include "implementations/qt_local/local_transport.h"
|
|
#include "implementations/qt_remote/remote_transport.h"
|
|
#include "implementations/mock/mock_transport.h"
|
|
|
|
namespace LogosTransportFactory {
|
|
|
|
std::unique_ptr<LogosTransportHost> createHost(const QString& registryUrl)
|
|
{
|
|
if (LogosModeConfig::isLocal()) {
|
|
return std::make_unique<LocalTransportHost>();
|
|
}
|
|
if (LogosModeConfig::isMock()) {
|
|
return std::make_unique<MockTransportHost>();
|
|
}
|
|
return std::make_unique<RemoteTransportHost>(registryUrl);
|
|
}
|
|
|
|
std::unique_ptr<LogosTransportConnection> createConnection(const QString& registryUrl)
|
|
{
|
|
if (LogosModeConfig::isLocal()) {
|
|
return std::make_unique<LocalTransportConnection>();
|
|
}
|
|
if (LogosModeConfig::isMock()) {
|
|
return std::make_unique<MockTransportConnection>();
|
|
}
|
|
return std::make_unique<RemoteTransportConnection>(registryUrl);
|
|
}
|
|
|
|
}
|