34 const std::string
prefix =
"mem.";
44 if (not properties->hasDefinition(
prefix +
"MemoryName"))
91 if (clientPlugin->isMemoryNameSystemEnabled() and clientPlugin->getMemoryNameSystemClient())
119 <<
"Stored working memory contents into long-term memory on component stop";
124 <<
"Not storing WM into LTM on stop, as longtermMemory.p.storeOnstop is "
131 <<
"Could not store working memory into the long-term memory on component stop.";
138 ARMARX_INFO <<
"Recording still in progress, stopping component anyways. "
139 "Saving statistics...";
145 ARMARX_WARNING <<
"Statistics could not be saved for recording that was interrupted by "
146 "disconnecting the component";
149 if (clientPlugin->isMemoryNameSystemEnabled() and clientPlugin->getMemoryNameSystemClient())
160 ARMARX_WARNING <<
"Please set the memory name before initializing the component. "
161 "Otherwise the WM and LTM may have different names";
167 mns::dto::RegisterServerResult
174 mns::dto::MemoryServerInterfaces
server;
175 server.reading = ReadingMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
176 server.writing = WritingMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
177 server.prediction = PredictingMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
178 server.actions = actions::ActionsInterfacePrx::uncheckedCast(
parent.getProxy());
179 server.configuration = ConfiguringMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
180 server.loading = LoadingMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
181 server.readingLtm = ReadingLongTermMemoryInterfacePrx::uncheckedCast(
parent.getProxy());
183 mns::dto::RegisterServerResult result;
186 clientPlugin->getMemoryNameSystemClient().registerServer(
id,
server);
187 result.success =
true;
189 <<
" in the Memory Name System (MNS).";
193 result.success =
false;
194 result.errorMessage = e.what();
202 mns::dto::RemoveServerResult
207 mns::dto::RemoveServerResult result;
210 clientPlugin->getMemoryNameSystemClient().removeServer(
id);
211 result.success =
true;
213 <<
" from the Memory Name System (MNS).";
217 result.success =
false;
218 result.errorMessage = e.what();
221 catch (
const Ice::NotRegisteredException&)
224 result.success =
false;
225 result.errorMessage =
"Memory Name System is gone.";
Baseclass for all ArmarX ManagedIceObjects requiring properties.
void addPluginDependency(ManagedIceObjectPlugin *dependedOn)
ManagedIceObject & parent()
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
friend class ManagedIceObject
const std::string & prefix() const
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
MemoryID withMemoryName(const std::string &name) const
static std::string MakeMemoryTopicName(const MemoryID &memoryID)
Indicates that a query to the Memory Name System failed.
void setMemoryName(const std::string &memoryName)
Set the name of the wm and the ltm.
virtual void postOnInitComponent() override
std::string memoryTopicName
Available at onInit().
server::ltm::Memory longtermMemory
A manager class for the ltm. It internally holds a normal wm instance as a cache.
virtual void preOnInitComponent() override
virtual void preOnConnectComponent() override
mns::dto::RegisterServerResult registerServer(armarx::Component &parent)
Register the parent component in the MNS.
mns::dto::RemoveServerResult removeServer()
Remove the parent component from the MNS.
client::MemoryListenerInterfacePrx memoryTopic
Available after onConnect().
virtual void postOnConnectComponent() override
virtual void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
MemoryToIceAdapter iceAdapter
Helps connecting memory to ice. Used to handle Ice callbacks.
virtual ~Plugin() override
virtual void preOnDisconnectComponent() override
server::wm::Memory workingMemory
The actual memory.
Plugin(ManagedIceObject &parent, std::string prefix)
#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...
#define ARMARX_INFO
The normal logging level.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.