DebugObserverComponentPlugin.cpp
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::ArmarXGuiComponentPlugins
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
26 
27 namespace armarx::plugins
28 {
29  void
31  {
33  ARMARX_CHECK_EMPTY(_topicName);
34  _topicName = name;
35  }
36 
37  std::string
39  {
40  return _topicName;
41  }
42 
43  void
45  {
46  if (_topicName.empty())
47  {
48  parent<Component>().getProperty(_topicName, makePropertyName(_propertyName));
49  }
50  parent<Component>().offeringTopic(_topicName);
51  }
52 
53  void
55  {
56  setChannelName(this);
57  }
58 
59  void
61  {
62  if (!getDebugObserver())
63  {
64  setDebugObserver(parent<Component>().getTopic<DebugObserverInterfacePrx>(_topicName));
65  }
66  }
67 
68  void
70  {
71  if (!properties->hasDefinition(makePropertyName(_propertyName)))
72  {
73  properties->defineOptionalProperty<std::string>(
74  makePropertyName(_propertyName),
75  "DebugObserver",
76  "Name of the topic the DebugObserver listens on");
77  }
78  }
79 } // namespace armarx::plugins
80 
81 namespace armarx
82 {
84  {
85  addPlugin(_debugObserverComponentPlugin);
86  }
87 
90  {
91  return *_debugObserverComponentPlugin;
92  }
93 
94  void
96  StringVariantBaseMap valueMap) const
97  {
98  _debugObserverComponentPlugin->setDebugObserverChannel(channelName, valueMap);
99  }
100 
101  void
103  const std::string& channelname) const
104  {
105  _debugObserverComponentPlugin->removeDebugObserverChannel(channelname);
106  }
107 
108  void
110  const std::string& channelName,
111  const std::string& datafieldName) const
112  {
113  _debugObserverComponentPlugin->removeDebugObserverDatafield(channelName, datafieldName);
114  }
115 
116  void
118  {
119  _debugObserverComponentPlugin->removeAllDebugObserverChannels();
120  }
121 
124  {
125  return _debugObserverComponentPlugin->getDebugObserver();
126  }
127 
128  void
130  {
131  _debugObserverComponentPlugin->setDebugObserverBatchModeEnabled(enable);
132  }
133 
134  void
136  {
137  _debugObserverComponentPlugin->sendDebugObserverBatch();
138  }
139 } // namespace armarx
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:110
armarx::DebugObserverComponentPluginUser::getDebugObserverComponentPlugin
plugins::DebugObserverComponentPlugin & getDebugObserverComponentPlugin()
Definition: DebugObserverComponentPlugin.cpp:89
armarx::DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverComponentPlugin.cpp:129
ARMARX_CHECK_EMPTY
#define ARMARX_CHECK_EMPTY(c)
Definition: ExpressionException.h:218
armarx::plugins::DebugObserverComponentPlugin::postOnInitComponent
void postOnInitComponent() override
Definition: DebugObserverComponentPlugin.cpp:54
armarx::DebugObserverHelper::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverHelper.cpp:71
armarx::plugins::DebugObserverComponentPlugin::setDebugObserverTopic
void setDebugObserverTopic(const std::string &name)
Definition: DebugObserverComponentPlugin.cpp:30
armarx::DebugObserverComponentPluginUser::setDebugObserverChannel
void setDebugObserverChannel(const std::string &channelName, StringVariantBaseMap valueMap) const
Definition: DebugObserverComponentPlugin.cpp:95
armarx::plugins::DebugObserverComponentPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: DebugObserverComponentPlugin.cpp:44
armarx::DebugObserverHelper::removeDebugObserverDatafield
void removeDebugObserverDatafield(const std::string &channelName, const std::string &datafieldName) const
Definition: DebugObserverHelper.cpp:170
ARMARX_CHECK_NOT_EMPTY
#define ARMARX_CHECK_NOT_EMPTY(c)
Definition: ExpressionException.h:224
armarx::ManagedIceObject::addPlugin
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
Definition: ManagedIceObject.h:186
armarx::DebugObserverComponentPluginUser::getDebugObserver
const DebugObserverInterfacePrx & getDebugObserver() const
Definition: DebugObserverComponentPlugin.cpp:123
armarx::DebugObserverComponentPluginUser::DebugObserverComponentPluginUser
DebugObserverComponentPluginUser()
Definition: DebugObserverComponentPlugin.cpp:83
armarx::DebugObserverComponentPluginUser::removeDebugObserverDatafield
void removeDebugObserverDatafield(const std::string &channelName, const std::string &datafieldName) const
Definition: DebugObserverComponentPlugin.cpp:109
armarx::DebugObserverHelper::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverHelper.cpp:64
armarx::plugins::DebugObserverComponentPlugin::getDebugObserverTopic
std::string getDebugObserverTopic()
Definition: DebugObserverComponentPlugin.cpp:38
armarx::DebugObserverHelper::getDebugObserver
const DebugObserverInterfacePrx & getDebugObserver() const
Definition: DebugObserverHelper.cpp:187
armarx::DebugObserverComponentPluginUser::removeAllDebugObserverChannels
void removeAllDebugObserverChannels() const
Definition: DebugObserverComponentPlugin.cpp:117
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:27
armarx::DebugObserverHelper::setChannelName
void setChannelName(const std::string &name)
Definition: DebugObserverHelper.cpp:208
DebugObserverComponentPlugin.h
armarx::DebugObserverHelper::removeDebugObserverChannel
void removeDebugObserverChannel(const std::string &channelname) const
Definition: DebugObserverHelper.cpp:162
Component.h
armarx::plugins::DebugObserverComponentPlugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: DebugObserverComponentPlugin.cpp:60
armarx::DebugObserverHelper::setDebugObserver
void setDebugObserver(const DebugObserverInterfacePrx &prx)
Definition: DebugObserverHelper.cpp:194
armarx::DebugObserverComponentPluginUser::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverComponentPlugin.cpp:135
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:56
armarx::plugins::DebugObserverComponentPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: DebugObserverComponentPlugin.cpp:69
armarx::DebugObserverComponentPluginUser::removeDebugObserverChannel
void removeDebugObserverChannel(const std::string &channelname) const
Definition: DebugObserverComponentPlugin.cpp:102
armarx::plugins::DebugObserverComponentPlugin
Brief description of class DebugObserverComponentPlugin.
Definition: DebugObserverComponentPlugin.h:46
armarx::DebugObserverHelper::removeAllDebugObserverChannels
void removeAllDebugObserverChannels() const
Definition: DebugObserverHelper.cpp:179
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::DebugObserverHelper::setDebugObserverChannel
void setDebugObserverChannel(const std::string &channelName, StringVariantBaseMap valueMap) const
Definition: DebugObserverHelper.cpp:153