ComponentPlugin.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package robdekon
17  * @author Christoph Pohl ( christoph dot pohl at kit dot edu )
18  * @date 07.09.22
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <experimental/memory>
26 
29 
31 
34 
36 #include "RemoteGui.h"
37 
38 namespace armarx::plugins
39 {
40  template <typename T>
42 
43  template <typename AronStructT>
44  requires isAronGenerated<AronStructT>
46  {
47  protected:
48  void
49  preOnInitComponent() override
50  {
53  parent<armarx::PropertyUser>(), prefix());
54  auto data = std::static_pointer_cast<armarx::aron::data::Variant>(
55  config_.getUpToDateReadBuffer().toAron());
56  auto type = config_.getUpToDateReadBuffer().ToAronType();
58  config_.getWriteBuffer().fromAron(
59  std::static_pointer_cast<armarx::aron::data::Dict>(data));
62  }
63 
64  void
66  {
69  const auto& config = config_.getUpToDateReadBuffer();
70  armarx::aron::data::visitRecursive(vis, config.toAron(), config.ToAronType());
72  }
73 
74  public:
76  buildRemoteGui(const std::string& name)
77  {
80  }
81 
82  bool
84  prx) // prx has to be already updated; otherwise nothing will change
85  {
88  auto& cfg = config_.getWriteBuffer();
89  auto data = std::static_pointer_cast<armarx::aron::data::Variant>(cfg.toAron());
90  auto type = cfg.ToAronType();
92  cfg.fromAron(std::static_pointer_cast<armarx::aron::data::Dict>(data));
94  return vis.tabRebuildRequired();
95  }
96 
99  {
100  ARMARX_TRACE;
101  }
102 
104  };
105 } // namespace armarx::plugins
armarx::plugins::AronComponentConfigPlugin
Definition: ComponentPlugin.h:45
armarx::RemoteGui::detail::GroupBoxBuilder
Definition: LayoutWidgets.h:166
armarx::plugins::AronComponentConfigPlugin::updateRemoteGui
bool updateRemoteGui(armarx::RemoteGui::TabProxy &prx)
Definition: ComponentPlugin.h:83
armarx::ManagedIceObjectPlugin::prefix
const std::string & prefix() const
Definition: ManagedIceObjectPlugin.cpp:63
armarx::ManagedIceObjectPlugin::parent
ManagedIceObject & parent()
Definition: ManagedIceObjectPlugin.cpp:69
armarx::WriteBufferedTripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:326
PropertyDefinitionVisitors.h
armarx::plugins::AronComponentConfigPlugin::buildRemoteGui
RemoteGui::detail::GroupBoxBuilder buildRemoteGui(const std::string &name)
Definition: ComponentPlugin.h:76
armarx::aron::component_config::PropertyDefinitionGetterVisitor
Definition: PropertyDefinitionVisitors.h:73
armarx::plugins::AronComponentConfigPlugin::AronComponentConfigPlugin
AronComponentConfigPlugin(ManagedIceObject &parent, const std::string &prefix)
Definition: ComponentPlugin.h:97
armarx::aron::component_config::PropertyDefinitionSetterVisitor
Definition: PropertyDefinitionVisitors.h:34
armarx::requires
requires(!aron::detail::DtoAndBoAreSame< DtoT, BoT >) void toAron(std
Definition: aron_conversions.h:377
armarx::aron::component_config::GetValueFromMapVisitor
Definition: RemoteGuiVisitors.h:88
armarx::RemoteGui::TabProxy
Definition: WidgetProxy.h:17
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
RemoteGui.h
armarx::aron::component_config::GetValueFromMapVisitor::tabRebuildRequired
bool tabRebuildRequired() const
Definition: RemoteGuiVisitors.cpp:566
ManagedIceObject.h
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:28
armarx::ComponentPlugin
Definition: ComponentPlugin.h:38
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
RecursiveVisitor.h
armarx::plugins::AronComponentConfigPlugin::config_
armarx::WriteBufferedTripleBuffer< AronStructT > config_
Definition: ComponentPlugin.h:103
armarx::WriteBufferedTripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:280
armarx::ComponentPlugin::postCreatePropertyDefinitions
virtual void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties)
Definition: ComponentPlugin.cpp:37
armarx::plugins::AronComponentConfigPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: ComponentPlugin.h:49
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:163
armarx::ManagedIceObjectPlugin::preOnInitComponent
virtual void preOnInitComponent()
Definition: ManagedIceObjectPlugin.h:62
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::aron::data::visitRecursive
requires isRecursiveVisitor< RecursiveVisitorImplementation, typename RecursiveVisitorImplementation::Input > void visitRecursive(RecursiveVisitorImplementation &v, typename RecursiveVisitorImplementation::Input &o)
Definition: RecursiveVisitor.h:146
armarx::WriteBufferedTripleBuffer< AronStructT >
ComponentPlugin.h
armarx::WriteBufferedTripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:296
RemoteGuiComponentPlugin.h
AronGeneratedClass.h
armarx::plugins::AronComponentConfigPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr &properties) override
Definition: ComponentPlugin.h:65
armarx::plugins::isAronGenerated
concept isAronGenerated
Definition: ComponentPlugin.h:41
armarx::RemoteGui::makeConfigGui
requires isAronGenerated< AronStructT > detail::GroupBoxBuilder makeConfigGui(const std::string &name, const AronStructT &val)
Definition: RemoteGui.h:41