From c9d9a33ff64436a2140510fcb4cd8e592ad0385f Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Fri, 3 Nov 2023 11:06:46 +0100 Subject: [PATCH] Update GetValueFromMapVisitor --- .../RemoteGuiVisitors.cpp | 51 +++++++++++++------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp b/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp index fc06569dc..b76afea29 100644 --- a/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp +++ b/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp @@ -511,36 +511,55 @@ namespace armarx::aron::component_config GetValueFromMapVisitor::visitListOnEnter(DataInput& o, TypeInput& t) { in_list_ = true; - auto data = data::List::DynamicCastAndCheck(o); + auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor(); - if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) == + + if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) != implementedListDescriptors.end()) { - return; - } - const auto& elements = data->getElements(); - for (const auto& [idx, el] : armarx::MakeIndexedContainer(elements)) - { - if (proxy_->getButtonClicked(pathToName(el) + "_button")) + auto data = data::List::DynamicCastAndCheck(o); + + const auto& elements = data->getElements(); + for (const auto& [idx, el] : armarx::MakeIndexedContainer(elements)) { - data->removeElement(idx); + if (proxy_->getButtonClicked(pathToName(el) + "_button")) + { + data->removeElement(idx); + tab_rebuild_required_ = true; + } + auto gui_value = proxy_->getValue<std::string>(pathToName(el)).get(); + factories::VariantHelper::make(type)->set_value_from_string(el, gui_value); + } + if (proxy_->getButtonClicked(pathToName(o) + "_add")) + { + data->addElement(factories::VariantHelper::make(type)->from_string( + "", o->getPath().withIndex(data->childrenSize()))); tab_rebuild_required_ = true; } - auto gui_value = proxy_->getValue<std::string>(pathToName(el)).get(); - factories::VariantHelper::make(type)->set_value_from_string(el, gui_value); } - if (proxy_->getButtonClicked(pathToName(o) + "_add")) + else { - data->addElement(factories::VariantHelper::make(type)->from_string( - "", o->getPath().withIndex(data->childrenSize()))); - tab_rebuild_required_ = true; + // TODO? Adapt to additional GroupBoxBuilder added by + // MakeConfigGuiVisitor::visitListOnEnter in this case? } } void - GetValueFromMapVisitor::visitListOnExit(DataInput&, TypeInput&) + GetValueFromMapVisitor::visitListOnExit(DataInput&, TypeInput& t) { in_list_ = false; + + auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor(); + + if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) != + implementedListDescriptors.end()) + { + } + else + { + // TODO? Adapt to additional GroupBoxBuilder added by + // MakeConfigGuiVisitor::visitListOnEnter in this case? + } } bool -- GitLab