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