RemoteGuiProvider.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 ArmarXGui::ArmarXObjects::RemoteGuiProvider
17  * @author Fabian Paus ( fabian dot paus at kit dot edu )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
26 #include <mutex>
27 
29 
30 #include <ArmarXGui/interface/RemoteGuiInterface.h>
32 
33 namespace armarx
34 {
35  /**
36  * @class RemoteGuiProviderPropertyDefinitions
37  * @brief
38  */
40  {
41  public:
44  {
45  defineOptionalProperty<std::string>(
46  "TopicName",
47  "RemoteGuiTopic",
48  "Name of the topic on which updates to the remote state are reported.");
49  }
50  };
51 
52  /**
53  * @defgroup Component-RemoteGuiProvider RemoteGuiProvider
54  * @ingroup ArmarXGui-Components
55  * A description of the component RemoteGuiProvider.
56  *
57  * @class RemoteGuiProvider
58  * @ingroup Component-RemoteGuiProvider
59  * @brief Brief description of class RemoteGuiProvider.
60  *
61  * Detailed description of class RemoteGuiProvider.
62  */
64  virtual public armarx::Component,
65  virtual public armarx::RemoteGuiInterface
66  {
67  public:
68  /**
69  * @see armarx::ManagedIceObject::getDefaultName()
70  */
71  std::string
72  getDefaultName() const override
73  {
74  return "RemoteGuiProvider";
75  }
76 
77  protected:
78  /**
79  * @see armarx::ManagedIceObject::onInitComponent()
80  */
81  void onInitComponent() override;
82 
83  /**
84  * @see armarx::ManagedIceObject::onConnectComponent()
85  */
86  void onConnectComponent() override;
87 
88  /**
89  * @see armarx::ManagedIceObject::onDisconnectComponent()
90  */
91  void onDisconnectComponent() override;
92 
93  /**
94  * @see armarx::ManagedIceObject::onExitComponent()
95  */
96  void onExitComponent() override;
97 
98  /**
99  * @see PropertyUser::createPropertyDefinitions()
100  */
102 
103  // RemoteGuiInterface interface
104  public:
105  std::string getTopicName(const Ice::Current&) override;
106 
107  void createTab(const std::string& tabId,
108  const RemoteGui::WidgetPtr& rootWidget,
109  const Ice::Current&) override;
110  void removeTab(const std::string& tabId, const Ice::Current&) override;
111 
112  RemoteGui::WidgetMap getTabs(const Ice::Current&) override;
113  RemoteGui::TabWidgetStateMap getTabStates(const Ice::Current&) override;
114  RemoteGui::TabValueMap getValuesForAllTabs(const Ice::Current&) override;
115  RemoteGui::ValueMap getValues(const std::string& tabId, const Ice::Current&) override;
116 
117  void setValue(const std::string& tabId,
118  const std::string& widgetName,
119  const RemoteGui::ValueVariant& value,
120  const Ice::Current&) override;
121  void setValues(const std::string& tabId,
123  const Ice::Current&) override;
124 
125  RemoteGui::WidgetStateMap getWidgetStates(const std::string& tabId,
126  const Ice::Current&) override;
127  void setWidgetStates(const std::string& tabId,
128  const RemoteGui::WidgetStateMap& state,
129  const Ice::Current&) override;
130 
131  private:
132  std::string topicName;
133 
134  RemoteGuiListenerInterfacePrx topic;
135 
136  std::mutex tabMutex;
137  RemoteGui::WidgetMap tabs;
138  RemoteGui::TabWidgetStateMap tabWidgetStates;
139  RemoteGui::TabValueMap tabStates;
140  };
141 } // namespace armarx
armarx::RemoteGuiProvider::getValuesForAllTabs
RemoteGui::TabValueMap getValuesForAllTabs(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:183
armarx::RemoteGuiProvider::getValues
RemoteGui::ValueMap getValues(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:190
armarx::RemoteGuiProvider::onInitComponent
void onInitComponent() override
Definition: RemoteGuiProvider.cpp:36
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::RemoteGui::ValueMap
std::map< std::string, ValueVariant > ValueMap
Definition: RemoteGuiVisitors.h:41
armarx::RemoteGuiProviderPropertyDefinitions
Definition: RemoteGuiProvider.h:39
armarx::RemoteGuiProvider::setValues
void setValues(const std::string &tabId, const RemoteGui::ValueMap &values, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:212
armarx::RemoteGuiProviderPropertyDefinitions::RemoteGuiProviderPropertyDefinitions
RemoteGuiProviderPropertyDefinitions(std::string prefix)
Definition: RemoteGuiProvider.h:42
armarx::RemoteGuiProvider::createTab
void createTab(const std::string &tabId, const RemoteGui::WidgetPtr &rootWidget, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:131
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::RemoteGuiProvider::getTabStates
RemoteGui::TabWidgetStateMap getTabStates(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:176
WidgetRegister.h
armarx::RemoteGuiProvider::onConnectComponent
void onConnectComponent() override
Definition: RemoteGuiProvider.cpp:44
armarx::RemoteGuiProvider::onExitComponent
void onExitComponent() override
Definition: RemoteGuiProvider.cpp:55
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:67
armarx::RemoteGuiProvider::setValue
void setValue(const std::string &tabId, const std::string &widgetName, const RemoteGui::ValueVariant &value, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:197
armarx::RemoteGuiProvider::getDefaultName
std::string getDefaultName() const override
Definition: RemoteGuiProvider.h:72
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
armarx::RemoteGuiProvider::setWidgetStates
void setWidgetStates(const std::string &tabId, const RemoteGui::WidgetStateMap &state, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:234
armarx::RemoteGuiProvider::getTopicName
std::string getTopicName(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:67
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGuiProvider::getWidgetStates
RemoteGui::WidgetStateMap getWidgetStates(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:227
armarx::RemoteGuiProvider::removeTab
void removeTab(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:155
armarx::RemoteGuiProvider::onDisconnectComponent
void onDisconnectComponent() override
Definition: RemoteGuiProvider.cpp:50
armarx::RemoteGuiProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RemoteGuiProvider.cpp:60
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::RemoteGuiProvider::getTabs
RemoteGui::WidgetMap getTabs(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:169
armarx::RemoteGuiProvider
Brief description of class RemoteGuiProvider.
Definition: RemoteGuiProvider.h:63