Component.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 control::ArmarXObjects::example_component_plugin_user
17  * @author Fabian Reister ( fabian dot reister at kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 
24 #pragma once
25 
26 
27 // #include <mutex>
28 
32 
33 // #include <ArmarXCore/libraries/ArmarXCoreComponentPlugins/DebugObserverComponentPlugin.h>
34 
35 // #include <ArmarXGui/libraries/ArmarXGuiComponentPlugins/LightweightRemoteGuiComponentPlugin.h>
36 
37 // #include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>
38 
39 #include <armarx/control/components/example_component_plugin_user/ComponentInterface.h>
41 
42 
44 {
45 
46  class Component :
47  virtual public armarx::Component,
49  // , virtual public armarx::DebugObserverComponentPluginUser
50  // , virtual public armarx::LightweightRemoteGuiComponentPluginUser
51  // , virtual public armarx::ArVizComponentPluginUser
53  virtual public armem::ClientPluginUser // TODO check if needed...
54  {
55  public:
56 
57  /// @see armarx::ManagedIceObject::getDefaultName()
58  std::string getDefaultName() const override;
59 
60  /// Get the component's default name.
61  static std::string GetDefaultName();
62 
63 
64  protected:
65 
66  /// @see PropertyUser::createPropertyDefinitions()
68 
69  /// @see armarx::ManagedIceObject::onInitComponent()
70  void onInitComponent() override;
71 
72  /// @see armarx::ManagedIceObject::onConnectComponent()
73  void onConnectComponent() override;
74 
75  /// @see armarx::ManagedIceObject::onDisconnectComponent()
76  void onDisconnectComponent() override;
77 
78  /// @see armarx::ManagedIceObject::onExitComponent()
79  void onExitComponent() override;
80 
81 
82  /* (Requires armarx::LightweightRemoteGuiComponentPluginUser.)
83  /// This function should be called once in onConnect() or when you
84  /// need to re-create the Remote GUI tab.
85  void createRemoteGuiTab();
86 
87  /// After calling `RemoteGui_startRunningTask`, this function is
88  /// called periodically in a separate thread. If you update variables,
89  /// make sure to synchronize access to them.
90  void RemoteGui_update() override;
91  */
92 
93 
94  private:
95 
96  // Private methods go here.
97 
98  // Forward declare `Properties` if you used it before its defined.
99  // struct Properties;
100 
101  /* (Requires the armarx::ArVizComponentPluginUser.)
102  /// Draw some boxes in ArViz.
103  void drawBoxes(const Properties& p, viz::Client& arviz);
104  */
105 
106 
107  private:
108 
109  static const std::string defaultName;
110 
111 
112  // Private member variables go here.
113 
114 
115  /// Properties shown in the Scenario GUI.
116  struct Properties
117  {
118  };
119  Properties properties;
120  /* Use a mutex if you access variables from different threads
121  * (e.g. ice functions and RemoteGui_update()).
122  std::mutex propertiesMutex;
123  */
124 
125 
126  /* (Requires the armarx::LightweightRemoteGuiComponentPluginUser.)
127  /// Tab shown in the Remote GUI.
128  struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
129  {
130  armarx::RemoteGui::Client::LineEdit boxLayerName;
131  armarx::RemoteGui::Client::IntSpinBox numBoxes;
132 
133  armarx::RemoteGui::Client::Button drawBoxes;
134  };
135  RemoteGuiTab tab;
136  */
137 
138 
139  /* (Requires the armarx::ArVizComponentPluginUser.)
140  * When used from different threads, an ArViz client needs to be synchronized.
141  /// Protects the arviz client inherited from the ArViz plugin.
142  std::mutex arvizMutex;
143  */
144 
145  };
146 
147 } // namespace armarx::control::components::example_component_plugin_user
armarx::control::components::example_component_plugin_user::Component::getDefaultName
std::string getDefaultName() const override
Definition: Component.cpp:291
armarx::control::components::example_component_plugin_user::Component::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: Component.cpp:45
armarx::control::components::example_component_plugin_user::Component::GetDefaultName
static std::string GetDefaultName()
Get the component's default name.
Definition: Component.cpp:298
armarx::armem::client::plugins::PluginUser
Adds the Memory Name System client component plugin.
Definition: PluginUser.h:29
armarx::control::client::ComponentPluginUser
Definition: ComponentPlugin.h:147
forward_declarations.h
armarx::control::components::example_component_plugin_user::Component::onDisconnectComponent
void onDisconnectComponent() override
Definition: Component.cpp:279
armarx::control::components::example_component_plugin_user::Component::onExitComponent
void onExitComponent() override
Definition: Component.cpp:285
armarx::control::components::example_component_plugin_user
Definition: Component.cpp:38
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::control::components::example_component_plugin_user::Component::onConnectComponent
void onConnectComponent() override
Definition: Component.cpp:84
IceUtil::Handle< class PropertyDefinitionContainer >
PluginUser.h
ComponentPlugin.h
armarx::control::components::example_component_plugin_user::Component
Definition: Component.h:46
armarx::control::components::example_component_plugin_user::ComponentInterface
Definition: ComponentInterface.ice:30
armarx::control::components::example_component_plugin_user::Component::onInitComponent
void onInitComponent() override
Definition: Component.cpp:73