Plugin.cpp
Go to the documentation of this file.
1 #include "Plugin.h"
2 
6 
10 
12 {
13 
14  Plugin::Plugin(ManagedIceObject& parent, std::string pre) : ComponentPlugin(parent, pre)
15  {
16  }
17 
19  {
20  }
21 
22  void
24  {
25  if (not properties->hasDefinition(makePropertyName(PROPERTY_MNS_NAME_NAME)))
26  {
27  properties->defineOptionalProperty<std::string>(
28  makePropertyName(PROPERTY_MNS_NAME_NAME),
29  memoryNameSystemName,
30  "Name of the Memory Name System (MNS) component.");
31  }
32  if (not properties->hasDefinition(makePropertyName(PROPERTY_MNS_ENABLED_NAME)))
33  {
34  properties->defineOptionalProperty<bool>(
35  makePropertyName(PROPERTY_MNS_ENABLED_NAME),
36  memoryNameSystemEnabled,
37  "Whether to use (and depend on) the Memory Name System (MNS)."
38  "\nSet to false to use this memory as a stand-alone.");
39  }
40  }
41 
42  void
44  {
45  parent<Component>().getProperty(memoryNameSystemName,
46  makePropertyName(PROPERTY_MNS_NAME_NAME));
47  parent<Component>().getProperty(memoryNameSystemEnabled,
48  makePropertyName(PROPERTY_MNS_ENABLED_NAME));
49 
51  {
53  }
54  }
55 
56  void
58  {
60  {
61  ARMARX_DEBUG << "Creating MemoryNameSystem client with owning component '"
62  << parent().getName() << "'.";
63  memoryNameSystem.initialize(getMemoryNameSystemProxy(), &parent());
64  }
65  }
66 
67  bool
69  {
70  return memoryNameSystemEnabled;
71  }
72 
73  std::string
75  {
76  return memoryNameSystemName;
77  }
78 
79  mns::MemoryNameSystemInterfacePrx
81  {
82  return isMemoryNameSystemEnabled() and parentDerives<ManagedIceObject>()
83  ? parent<ManagedIceObject>().getProxy<mns::MemoryNameSystemInterfacePrx>(
85  : nullptr;
86  }
87 
90  {
91  return memoryNameSystem;
92  }
93 
94  const MemoryNameSystem&
96  {
97  return memoryNameSystem;
98  }
99 
100 } // namespace armarx::armem::client::plugins
Plugin.h
armarx::armem::client::plugins::Plugin::getMemoryNameSystemName
std::string getMemoryNameSystemName()
Get the name of the MNS component.
Definition: Plugin.cpp:74
armarx::armem::client::plugins::Plugin::isMemoryNameSystemEnabled
bool isMemoryNameSystemEnabled()
Indicate whether the Memory Name System (MNS) is enabled.
Definition: Plugin.cpp:68
armarx::armem::client::plugins::Plugin::getMemoryNameSystemClient
MemoryNameSystem & getMemoryNameSystemClient()
Get the MNS client.
Definition: Plugin.cpp:89
armarx::ManagedIceObjectPlugin::parent
ManagedIceObject & parent()
Definition: ManagedIceObjectPlugin.cpp:72
armarx::armem::client::plugins::Plugin::getMemoryNameSystemProxy
mns::MemoryNameSystemInterfacePrx getMemoryNameSystemProxy()
Get the MNS proxy.
Definition: Plugin.cpp:80
armarx::armem::client::plugins::Plugin::preOnInitComponent
void preOnInitComponent() override
Definition: Plugin.cpp:43
armarx::armem::client::plugins::Plugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: Plugin.cpp:57
armarx::ComponentPlugin
Definition: ComponentPlugin.h:37
armarx::armem::client::plugins::Plugin::Plugin
Plugin(ManagedIceObject &parent, std::string pre)
Definition: Plugin.cpp:14
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:184
error.h
ice_conversions.h
Component.h
ExpressionException.h
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:162
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::client::plugins
This file is part of ArmarX.
Definition: forward_declarations.h:23
armarx::armem::client::MemoryNameSystem::initialize
void initialize(mns::MemoryNameSystemInterfacePrx mns, ManagedIceObject *component=nullptr)
Definition: MemoryNameSystem.cpp:26
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:56
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:73
armarx::ManagedIceObject::getName
std::string getName() const
Retrieve name of object.
Definition: ManagedIceObject.cpp:108
MemoryNameSystem.h
Logging.h
armarx::armem::client::plugins::Plugin::~Plugin
virtual ~Plugin() override
Definition: Plugin.cpp:18
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:154
armarx::armem::client::plugins::Plugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: Plugin.cpp:23