84 lines
2.1 KiB
C++
84 lines
2.1 KiB
C++
#include "RuntimeServices.h"
|
|
|
|
RuntimeServices::RuntimeServices() :
|
|
mControlServices(std::make_unique<ControlServices>())
|
|
{
|
|
}
|
|
|
|
RuntimeServices::~RuntimeServices()
|
|
{
|
|
Stop();
|
|
}
|
|
|
|
bool RuntimeServices::Start(OpenGLComposite& composite, RuntimeHost& runtimeHost, std::string& error)
|
|
{
|
|
return mControlServices && mControlServices->Start(composite, runtimeHost, error);
|
|
}
|
|
|
|
void RuntimeServices::BeginPolling(RuntimeHost& runtimeHost)
|
|
{
|
|
if (mControlServices)
|
|
mControlServices->BeginPolling(runtimeHost);
|
|
}
|
|
|
|
void RuntimeServices::Stop()
|
|
{
|
|
if (mControlServices)
|
|
mControlServices->Stop();
|
|
}
|
|
|
|
void RuntimeServices::BroadcastState()
|
|
{
|
|
if (mControlServices)
|
|
mControlServices->BroadcastState();
|
|
}
|
|
|
|
void RuntimeServices::RequestBroadcastState()
|
|
{
|
|
if (mControlServices)
|
|
mControlServices->RequestBroadcastState();
|
|
}
|
|
|
|
bool RuntimeServices::QueueOscUpdate(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error)
|
|
{
|
|
return mControlServices && mControlServices->QueueOscUpdate(layerKey, parameterKey, valueJson, error);
|
|
}
|
|
|
|
bool RuntimeServices::ApplyPendingOscUpdates(std::vector<AppliedOscUpdate>& appliedUpdates, std::string& error)
|
|
{
|
|
if (!mControlServices)
|
|
{
|
|
appliedUpdates.clear();
|
|
return true;
|
|
}
|
|
|
|
return mControlServices->ApplyPendingOscUpdates(appliedUpdates, error);
|
|
}
|
|
|
|
bool RuntimeServices::QueueOscCommit(const std::string& routeKey, const std::string& layerKey, const std::string& parameterKey, const JsonValue& value, uint64_t generation, std::string& error)
|
|
{
|
|
return mControlServices && mControlServices->QueueOscCommit(routeKey, layerKey, parameterKey, value, generation, error);
|
|
}
|
|
|
|
void RuntimeServices::ClearOscState()
|
|
{
|
|
if (mControlServices)
|
|
mControlServices->ClearOscState();
|
|
}
|
|
|
|
void RuntimeServices::ConsumeCompletedOscCommits(std::vector<CompletedOscCommit>& completedCommits)
|
|
{
|
|
if (!mControlServices)
|
|
{
|
|
completedCommits.clear();
|
|
return;
|
|
}
|
|
|
|
mControlServices->ConsumeCompletedOscCommits(completedCommits);
|
|
}
|
|
|
|
RuntimePollEvents RuntimeServices::ConsumePollEvents()
|
|
{
|
|
return mControlServices ? mControlServices->ConsumePollEvents() : RuntimePollEvents{};
|
|
}
|