GraspCandidateObserverComponentPlugin.cpp
Go to the documentation of this file.
1 #include <SimoxUtility/algorithm/string/string_tools.h>
2 
4 
6 
7 namespace armarx
8 {
9  namespace plugins
10  {
11 
13  {
14  parent<Component>().usingProxyFromProperty(PROPERTY_NAME);
15  if (!_graspCandidateObserver && _graspCandidateObserverName.empty())
16  {
17  parent<Component>().getProperty(_graspCandidateObserverName, makePropertyName(PROPERTY_NAME));
18  }
19 
20  if (!_graspCandidateObserver)
21  {
22  parent<Component>().usingProxy(_graspCandidateObserverName);
23  }
24  }
25 
27  {
28  if (!_graspCandidateObserver)
29  {
30  parent<Component>().getProxy(_graspCandidateObserver, _graspCandidateObserverName);
31  }
32  }
33 
35  {
36  _graspCandidateObserver = nullptr;
37  }
38 
40  {
41  if (!properties->hasDefinition(PROPERTY_NAME))
42  {
43  properties->defineOptionalProperty<std::string>(
44  PROPERTY_NAME,
45  "GraspCandidateObserver",
46  "Name of the GraspCandidateObserver");
47  }
48  }
49 
50  grasping::GraspCandidateObserverInterfacePrx GraspCandidateObserverComponentPlugin::getGraspCandidateObserver()
51  {
52  return _graspCandidateObserver;
53  }
54 
56  {
57  return _graspCandidateObserverName;
58  }
59 
60  grasping::GraspCandidateSeq GraspCandidateObserverComponentPlugin::getAllCandidates() const
61  {
62  if (_graspCandidateObserver)
63  {
64  return _graspCandidateObserver->getAllCandidates();
65  }
66  return {};
67  }
68 
69  grasping::GraspCandidateSeq GraspCandidateObserverComponentPlugin::getCandidates() const
70  {
71  if (!_graspCandidateObserver)
72  {
73  return {};
74  }
75  if (_upstream_providers.empty())
76  {
77  return _graspCandidateObserver->getAllCandidates();
78  }
79  return _graspCandidateObserver->getCandidatesByProviders(_upstream_providers);
80  }
81 
83  {
84  _upstream_providers = std::move(pr);
85  }
86 
87  void GraspCandidateObserverComponentPlugin::setUpstreamGraspCandidateProvidersFromCSV(const std::string& csv, const std::string& delim)
88  {
90  }
91 
93  {
94  _graspCandidateObserverName = name;
95  }
96  }
97 }
98 
99 namespace armarx
100 {
102  {
103  addPlugin(plugin);
104  }
105 
106  grasping::GraspCandidateObserverInterfacePrx GraspCandidateObserverComponentPluginUser::getGraspCandidateObserver()
107  {
108  return plugin->getGraspCandidateObserver();
109  }
110 
112  {
113  ARMARX_CHECK_NOT_NULL(plugin);
114  return *plugin;
115  }
116 
118  {
119  ARMARX_CHECK_NOT_NULL(plugin);
120  return *plugin;
121  }
122 
124  {
126  }
127 
129  {
131  }
132 }
armarx::plugins::GraspCandidateObserverComponentPlugin::setUpstreamGraspCandidateProviders
void setUpstreamGraspCandidateProviders(std::vector< std::string > pr)
Definition: GraspCandidateObserverComponentPlugin.cpp:82
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::plugins::GraspCandidateObserverComponentPlugin::getAllCandidates
grasping::GraspCandidateSeq getAllCandidates() const
Definition: GraspCandidateObserverComponentPlugin.cpp:60
armarx::GraspCandidateObserverComponentPluginUser::GraspCandidateObserverComponentPluginUser
GraspCandidateObserverComponentPluginUser()
Definition: GraspCandidateObserverComponentPlugin.cpp:101
armarx::GraspCandidateObserverComponentPluginUser::getGraspCandidateObserverComponentPlugin
armarx::plugins::GraspCandidateObserverComponentPlugin & getGraspCandidateObserverComponentPlugin()
Definition: GraspCandidateObserverComponentPlugin.cpp:111
armarx::ManagedIceObject::addPlugin
PluginT * addPlugin(const std::string prefix="", ParamsT &&...params)
Definition: ManagedIceObject.h:182
armarx::plugins::GraspCandidateObserverComponentPlugin::setGraspCandidateObserverName
void setGraspCandidateObserverName(const std::string &name)
Definition: GraspCandidateObserverComponentPlugin.cpp:92
plugins
armarx::plugins::GraspCandidateObserverComponentPlugin::postOnDisconnectComponent
void postOnDisconnectComponent() override
Definition: GraspCandidateObserverComponentPlugin.cpp:34
GraspCandidateObserverComponentPlugin.h
armarx::GraspCandidateObserverComponentPluginUser::getGraspCandidateObserver
grasping::GraspCandidateObserverInterfacePrx getGraspCandidateObserver()
Definition: GraspCandidateObserverComponentPlugin.cpp:106
armarx::plugins::GraspCandidateObserverComponentPlugin
Definition: GraspCandidateObserverComponentPlugin.h:10
armarx::GraspCandidateObserverComponentPluginUser::getAllGraspCandidates
grasping::GraspCandidateSeq getAllGraspCandidates() const
Definition: GraspCandidateObserverComponentPlugin.cpp:123
armarx::plugins::GraspCandidateObserverComponentPlugin::setUpstreamGraspCandidateProvidersFromCSV
void setUpstreamGraspCandidateProvidersFromCSV(const std::string &csv, const std::string &delim=",;")
Definition: GraspCandidateObserverComponentPlugin.cpp:87
armarx::plugins::GraspCandidateObserverComponentPlugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: GraspCandidateObserverComponentPlugin.cpp:26
armarx::plugins::GraspCandidateObserverComponentPlugin::getGraspCandidateObserverName
const std::string & getGraspCandidateObserverName() const
Definition: GraspCandidateObserverComponentPlugin.cpp:55
Component.h
armarx::plugins::GraspCandidateObserverComponentPlugin::getCandidates
grasping::GraspCandidateSeq getCandidates() const
Definition: GraspCandidateObserverComponentPlugin.cpp:69
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:53
armarx::GraspCandidateObserverComponentPluginUser::getGraspCandidates
grasping::GraspCandidateSeq getGraspCandidates() const
Definition: GraspCandidateObserverComponentPlugin.cpp:128
armarx::plugins::GraspCandidateObserverComponentPlugin::getGraspCandidateObserver
grasping::GraspCandidateObserverInterfacePrx getGraspCandidateObserver()
Definition: GraspCandidateObserverComponentPlugin.cpp:50
armarx::plugins::GraspCandidateObserverComponentPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: GraspCandidateObserverComponentPlugin.cpp:39
armarx::plugins::GraspCandidateObserverComponentPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: GraspCandidateObserverComponentPlugin.cpp:12
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::split
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelpers.cpp:36