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 
28 namespace armarx::plugins
29 {
31  {
33  ARMARX_CHECK_EMPTY(_topicName);
34  _topicName = name;
35  }
36 
38  {
39  return _topicName;
40  }
41 
43  {
44  if (_topicName.empty())
45  {
46  parent<Component>().getProperty(_topicName, makePropertyName(_propertyName));
47  }
48  parent<Component>().offeringTopic(_topicName);
49  }
50 
52  {
53  setChannelName(this);
54  }
55 
57  {
58  if (!getDebugObserver())
59  {
60  setDebugObserver(parent<Component>()
61  .getTopic<DebugObserverInterfacePrx>(_topicName));
62 
63  }
64  }
65 
67  {
68  if (!properties->hasDefinition(makePropertyName(_propertyName)))
69  {
70  properties->defineOptionalProperty<std::string>(
71  makePropertyName(_propertyName),
72  "DebugObserver",
73  "Name of the topic the DebugObserver listens on");
74  }
75  }
76 }
77 
78 namespace armarx
79 {
81  {
82  addPlugin(_debugObserverComponentPlugin);
83  }
84 
86  {
87  return *_debugObserverComponentPlugin;
88  }
89 
91  const std::string& channelName,
92  StringVariantBaseMap valueMap) const
93  {
94  _debugObserverComponentPlugin->setDebugObserverChannel(channelName, valueMap);
95  }
97  const std::string& channelname) const
98  {
99  _debugObserverComponentPlugin->removeDebugObserverChannel(channelname);
100  }
102  const std::string& channelName,
103  const std::string& datafieldName) const
104  {
105  _debugObserverComponentPlugin->removeDebugObserverDatafield(channelName, datafieldName);
106  }
107 
109  {
110  _debugObserverComponentPlugin->removeAllDebugObserverChannels();
111  }
112 
114  {
115  return _debugObserverComponentPlugin->getDebugObserver();
116  }
117 
119  {
120  _debugObserverComponentPlugin->setDebugObserverBatchModeEnabled(enable);
121  }
123  {
124  _debugObserverComponentPlugin->sendDebugObserverBatch();
125  }
126 }
127 
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::DebugObserverComponentPluginUser::getDebugObserverComponentPlugin
plugins::DebugObserverComponentPlugin & getDebugObserverComponentPlugin()
Definition: DebugObserverComponentPlugin.cpp:85
armarx::DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverComponentPlugin.cpp:118
ARMARX_CHECK_EMPTY
#define ARMARX_CHECK_EMPTY(c)
Definition: ExpressionException.h:218
armarx::plugins::DebugObserverComponentPlugin::postOnInitComponent
void postOnInitComponent() override
Definition: DebugObserverComponentPlugin.cpp:51
armarx::DebugObserverHelper::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverHelper.cpp:63
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:90
armarx::plugins::DebugObserverComponentPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: DebugObserverComponentPlugin.cpp:42
armarx::DebugObserverHelper::removeDebugObserverDatafield
void removeDebugObserverDatafield(const std::string &channelName, const std::string &datafieldName) const
Definition: DebugObserverHelper.cpp:135
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:182
armarx::DebugObserverComponentPluginUser::getDebugObserver
const DebugObserverInterfacePrx & getDebugObserver() const
Definition: DebugObserverComponentPlugin.cpp:113
armarx::DebugObserverComponentPluginUser::DebugObserverComponentPluginUser
DebugObserverComponentPluginUser()
Definition: DebugObserverComponentPlugin.cpp:80
armarx::DebugObserverComponentPluginUser::removeDebugObserverDatafield
void removeDebugObserverDatafield(const std::string &channelName, const std::string &datafieldName) const
Definition: DebugObserverComponentPlugin.cpp:101
armarx::DebugObserverHelper::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverHelper.cpp:58
armarx::plugins::DebugObserverComponentPlugin::getDebugObserverTopic
std::string getDebugObserverTopic()
Definition: DebugObserverComponentPlugin.cpp:37
armarx::DebugObserverHelper::getDebugObserver
const DebugObserverInterfacePrx & getDebugObserver() const
Definition: DebugObserverHelper.cpp:149
armarx::DebugObserverComponentPluginUser::removeAllDebugObserverChannels
void removeAllDebugObserverChannels() const
Definition: DebugObserverComponentPlugin.cpp:108
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:28
armarx::DebugObserverHelper::setChannelName
void setChannelName(const std::string &name)
Definition: DebugObserverHelper.cpp:166
DebugObserverComponentPlugin.h
armarx::DebugObserverHelper::removeDebugObserverChannel
void removeDebugObserverChannel(const std::string &channelname) const
Definition: DebugObserverHelper.cpp:128
Component.h
armarx::plugins::DebugObserverComponentPlugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: DebugObserverComponentPlugin.cpp:56
armarx::DebugObserverHelper::setDebugObserver
void setDebugObserver(const DebugObserverInterfacePrx &prx)
Definition: DebugObserverHelper.cpp:154
armarx::DebugObserverComponentPluginUser::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverComponentPlugin.cpp:122
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:53
armarx::plugins::DebugObserverComponentPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: DebugObserverComponentPlugin.cpp:66
armarx::DebugObserverComponentPluginUser::removeDebugObserverChannel
void removeDebugObserverChannel(const std::string &channelname) const
Definition: DebugObserverComponentPlugin.cpp:96
armarx::plugins::DebugObserverComponentPlugin
Brief description of class DebugObserverComponentPlugin.
Definition: DebugObserverComponentPlugin.h:48
armarx::DebugObserverHelper::removeAllDebugObserverChannels
void removeAllDebugObserverChannels() const
Definition: DebugObserverHelper.cpp:142
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::DebugObserverHelper::setDebugObserverChannel
void setDebugObserverChannel(const std::string &channelName, StringVariantBaseMap valueMap) const
Definition: DebugObserverHelper.cpp:121