From 32aee0ac4369078f1cfbb53ff5bdc05e883eb3a6 Mon Sep 17 00:00:00 2001 From: Fabian Paus <fabian.paus@kit.edu> Date: Tue, 4 Jan 2022 16:34:45 +0100 Subject: [PATCH] ArViz: Add usingProxy to component plugin --- .../components/ArViz/Client/Client.cpp | 27 +++++++++++++++++++ .../RobotAPI/components/ArViz/Client/Client.h | 27 +++---------------- .../ArVizComponentPlugin.cpp | 1 + 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/source/RobotAPI/components/ArViz/Client/Client.cpp b/source/RobotAPI/components/ArViz/Client/Client.cpp index e40147d69..3e6bcf38c 100644 --- a/source/RobotAPI/components/ArViz/Client/Client.cpp +++ b/source/RobotAPI/components/ArViz/Client/Client.cpp @@ -68,6 +68,33 @@ Client Client::createForGuiPlugin(Component& component, return client; } +CommitResult Client::commit(const StagedCommit& commit) +{ + CommitResult result; + result.data_ = storage->commitAndReceiveInteractions(commit.data_); + return result; +} + +CommitResultAsync Client::commitAsync(const StagedCommit& commit) +{ + CommitResultAsync result; + result.async = storage->begin_commitAndReceiveInteractions(commit.data_); + result.storage = storage; + return result; +} + +void Client::commit(const std::vector<Layer>& layers) +{ + data::LayerUpdateSeq updates; + updates.reserve(layers.size()); + for (Layer const& layer : layers) + { + updates.push_back(layer.data_); + } + // This commit call still uses the legacy topic API + topic->updateLayers(updates); +} + } diff --git a/source/RobotAPI/components/ArViz/Client/Client.h b/source/RobotAPI/components/ArViz/Client/Client.h index 0a93e7025..68e086ac5 100644 --- a/source/RobotAPI/components/ArViz/Client/Client.h +++ b/source/RobotAPI/components/ArViz/Client/Client.h @@ -313,37 +313,16 @@ namespace viz return StagedCommit(); } - CommitResult commit(StagedCommit const& commit) - { - CommitResult result; - result.data_ = storage->commitAndReceiveInteractions(commit.data_); - return result; - } + CommitResult commit(StagedCommit const& commit); - CommitResultAsync commitAsync(StagedCommit const& commit) - { - CommitResultAsync result; - result.async = storage->begin_commitAndReceiveInteractions(commit.data_); - result.storage = storage; - return result; - } + CommitResultAsync commitAsync(StagedCommit const& commit); void commit(Layer const& layer) { commit({layer}); } - void commit(std::vector<Layer> const& layers) - { - data::LayerUpdateSeq updates; - updates.reserve(layers.size()); - for (Layer const& layer : layers) - { - updates.push_back(layer.data_); - } - // This commit call still uses the legacy topic API - topic->updateLayers(updates); - } + void commit(std::vector<Layer> const& layers); void commitLayerContaining(std::string const& name) { diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.cpp index 200268977..7c63d33b7 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.cpp +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.cpp @@ -29,6 +29,7 @@ namespace armarx::plugins void ArVizComponentPlugin::preOnInitComponent() { parent().offeringTopic(getTopicName()); + parent().usingProxy(getStorageName()); } void ArVizComponentPlugin::preOnConnectComponent() -- GitLab