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 
27 
28 #include <ArmarXGui/interface/RemoteGuiInterface.h>
30 
31 #include <mutex>
32 
33 namespace armarx
34 {
35  /**
36  * @class RemoteGuiProviderPropertyDefinitions
37  * @brief
38  */
41  {
42  public:
45  {
46  defineOptionalProperty<std::string>("TopicName", "RemoteGuiTopic", "Name of the topic on which updates to the remote state are reported.");
47  }
48  };
49 
50  /**
51  * @defgroup Component-RemoteGuiProvider RemoteGuiProvider
52  * @ingroup ArmarXGui-Components
53  * A description of the component RemoteGuiProvider.
54  *
55  * @class RemoteGuiProvider
56  * @ingroup Component-RemoteGuiProvider
57  * @brief Brief description of class RemoteGuiProvider.
58  *
59  * Detailed description of class RemoteGuiProvider.
60  */
62  : virtual public armarx::Component
63  , virtual public armarx::RemoteGuiInterface
64  {
65  public:
66  /**
67  * @see armarx::ManagedIceObject::getDefaultName()
68  */
69  std::string getDefaultName() const override
70  {
71  return "RemoteGuiProvider";
72  }
73 
74  protected:
75  /**
76  * @see armarx::ManagedIceObject::onInitComponent()
77  */
78  void onInitComponent() override;
79 
80  /**
81  * @see armarx::ManagedIceObject::onConnectComponent()
82  */
83  void onConnectComponent() override;
84 
85  /**
86  * @see armarx::ManagedIceObject::onDisconnectComponent()
87  */
88  void onDisconnectComponent() override;
89 
90  /**
91  * @see armarx::ManagedIceObject::onExitComponent()
92  */
93  void onExitComponent() override;
94 
95  /**
96  * @see PropertyUser::createPropertyDefinitions()
97  */
99 
100  // RemoteGuiInterface interface
101  public:
102  std::string getTopicName(const Ice::Current&) override;
103 
104  void createTab(const std::string& tabId, const RemoteGui::WidgetPtr& rootWidget, const Ice::Current&) override;
105  void removeTab(const std::string& tabId, const Ice::Current&) override;
106 
107  RemoteGui::WidgetMap getTabs(const Ice::Current&) override;
108  RemoteGui::TabWidgetStateMap getTabStates(const Ice::Current&) override;
109  RemoteGui::TabValueMap getValuesForAllTabs(const Ice::Current&) override;
110  RemoteGui::ValueMap getValues(const std::string& tabId, const Ice::Current&) override;
111 
112  void setValue(const std::string& tabId, const std::string& widgetName, const RemoteGui::ValueVariant& value, const Ice::Current&) override;
113  void setValues(const std::string& tabId, const RemoteGui::ValueMap& values, const Ice::Current&) override;
114 
115  RemoteGui::WidgetStateMap getWidgetStates(const std::string& tabId, const Ice::Current&) override;
116  void setWidgetStates(const std::string& tabId, const RemoteGui::WidgetStateMap& state, const Ice::Current&) override;
117 
118  private:
119  std::string topicName;
120 
121  RemoteGuiListenerInterfacePrx topic;
122 
123  std::mutex tabMutex;
124  RemoteGui::WidgetMap tabs;
125  RemoteGui::TabWidgetStateMap tabWidgetStates;
126  RemoteGui::TabValueMap tabStates;
127  };
128 }
armarx::RemoteGuiProvider::getValuesForAllTabs
RemoteGui::TabValueMap getValuesForAllTabs(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:176
armarx::RemoteGuiProvider::getValues
RemoteGui::ValueMap getValues(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:182
armarx::RemoteGuiProvider::onInitComponent
void onInitComponent() override
Definition: RemoteGuiProvider.cpp:35
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
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:199
armarx::RemoteGuiProviderPropertyDefinitions::RemoteGuiProviderPropertyDefinitions
RemoteGuiProviderPropertyDefinitions(std::string prefix)
Definition: RemoteGuiProvider.h:43
armarx::RemoteGuiProvider::createTab
void createTab(const std::string &tabId, const RemoteGui::WidgetPtr &rootWidget, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:130
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::RemoteGuiProvider::getTabStates
RemoteGui::TabWidgetStateMap getTabStates(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:170
WidgetRegister.h
armarx::RemoteGuiProvider::onConnectComponent
void onConnectComponent() override
Definition: RemoteGuiProvider.cpp:43
armarx::RemoteGuiProvider::onExitComponent
void onExitComponent() override
Definition: RemoteGuiProvider.cpp:55
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:66
armarx::RemoteGuiProvider::setValue
void setValue(const std::string &tabId, const std::string &widgetName, const RemoteGui::ValueVariant &value, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:188
armarx::RemoteGuiProvider::getDefaultName
std::string getDefaultName() const override
Definition: RemoteGuiProvider.h:69
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::RemoteGuiProvider::setWidgetStates
void setWidgetStates(const std::string &tabId, const RemoteGui::WidgetStateMap &state, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:217
armarx::RemoteGuiProvider::getTopicName
std::string getTopicName(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:66
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGuiProvider::getWidgetStates
RemoteGui::WidgetStateMap getWidgetStates(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:211
armarx::RemoteGuiProvider::removeTab
void removeTab(const std::string &tabId, const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:151
armarx::RemoteGuiProvider::onDisconnectComponent
void onDisconnectComponent() override
Definition: RemoteGuiProvider.cpp:49
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:28
armarx::RemoteGuiProvider::getTabs
RemoteGui::WidgetMap getTabs(const Ice::Current &) override
Definition: RemoteGuiProvider.cpp:164
armarx::RemoteGuiProvider
Brief description of class RemoteGuiProvider.
Definition: RemoteGuiProvider.h:61