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
38namespace armarx::plugins
39{
40 template <typename T>
41 concept isAronGenerated = std::is_base_of<armarx::aron::cpp::AronGeneratedClass, T>::value;
42
43 template <typename AronStructT>
46 {
47 protected:
48 void
50 {
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));
60 config_.commitWrite();
62 }
63
64 void
66 {
69 prefix());
70 const auto& config = config_.getUpToDateReadBuffer();
71 armarx::aron::data::visitRecursive(vis, config.toAron(), config.ToAronType());
73 }
74
75 public:
77 buildRemoteGui(const std::string& name)
78 {
80 return RemoteGui::makeConfigGui(name, config_.getUpToDateReadBuffer());
81 }
82
83 bool
85 prx) // prx has to be already updated; otherwise nothing will change
86 {
89 auto& cfg = config_.getWriteBuffer();
90 auto data = std::static_pointer_cast<armarx::aron::data::Variant>(cfg.toAron());
91 auto type = cfg.ToAronType();
93 cfg.fromAron(std::static_pointer_cast<armarx::aron::data::Dict>(data));
94 config_.commitWrite();
95 return vis.tabRebuildRequired();
96 }
97
103
105 };
106} // namespace armarx::plugins
virtual void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties)
const std::string & prefix() const
Same as the TripleBuffer, but partial writes of the data structure are ok. The write operation may be...
AronComponentConfigPlugin(ManagedIceObject &parent, const std::string &prefix)
bool updateRemoteGui(armarx::RemoteGui::TabProxy &prx)
armarx::WriteBufferedTripleBuffer< AronStructT > config_
RemoteGui::detail::GroupBoxBuilder buildRemoteGui(const std::string &name)
void postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr &properties) override
detail::GroupBoxBuilder makeConfigGui(const std::string &name, const AronStructT &val)
Definition RemoteGui.h:41
void visitRecursive(RecursiveVisitorImplementation &v, typename RecursiveVisitorImplementation::Input &o)
This file is part of ArmarX.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
#define ARMARX_TRACE
Definition trace.h:77