25#include <IceUtil/UUID.h>
28#include <ArmarXCore/interface/core/Log.h>
34#define COMMONSTORAGE_NAME "CommonStorage"
79 ARMARX_INFO <<
"Starting MemoryX::AbstractWorkingMemory";
113 AbstractWorkingMemoryInterfacePrx::uncheckedCast(
getProxy()));
117 AbstractMemorySegmentPrx
119 const AbstractMemorySegmentPtr& segment,
120 const ::Ice::Current&
c)
122 AbstractWorkingMemorySegmentPtr wmSegment =
123 AbstractWorkingMemorySegmentPtr::dynamicCast(segment);
133 ARMARX_INFO <<
"Added AbstractWorkingMemorySegment: " << segmentName;
138 WorkingMemoryUpdaterBasePrx
140 const WorkingMemoryUpdaterBasePtr& updater,
141 const ::Ice::Current&)
145 updaterImpl->setWorkingMemory(
this);
149 std::pair<std::string, MemoryUpdaterEntry> updaterEntry;
150 updaterEntry.first = updaterName;
151 updaterEntry.second.proxy =
152 WorkingMemoryUpdaterBasePrx::uncheckedCast(updaterImpl->getProxy());
153 updaterEntry.second.pointer = updaterImpl;
158 ARMARX_INFO <<
"Registered AbstractWorkingMemoryUpdater: " << updaterName;
160 return updaterEntry.second.proxy;
163 WorkingMemoryUpdaterBasePrx
169 MemoryUpdaterMap::iterator iter =
updaters.find(updaterName);
173 throw InvalidEntityException();
176 return iter->second.proxy;
184 MemoryUpdaterMap::iterator iter =
updaters.find(updaterName);
189 WorkingMemoryUpdaterPtr::dynamicCast(iter->second.pointer);
197 ARMARX_INFO <<
"Unregistered AbstractWorkingMemoryUpdater: " << updaterName;
206 for (MemorySegmentMap::iterator it =
segments.begin(); it !=
segments.end(); ++it)
208 it->second.pointer->clear();
217 std::cout <<
"Memory contains " <<
segments.size() <<
" segments" << std::endl;
219 for (MemorySegmentMap::const_iterator it =
segments.begin(); it !=
segments.end(); ++it)
221 std::cout <<
"Memory segment " << it->first <<
" contains "
222 << it->second.pointer->size() <<
" entities" << std::endl;
223 it->second.pointer->print();
#define COMMONSTORAGE_NAME
Property< PropertyType > getProperty(const std::string &name)
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.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
IceManagerPtr getIceManager() const
Returns the IceManager.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
AbstractMemorySegmentPrx addSegment(const std::string &segmentName, const AbstractMemorySegmentPtr &segment, const ::Ice::Current &=Ice::emptyCurrent) override
std::shared_mutex updaterMutex
void onInitComponent() override
Pure virtual hook for the subclass.
CommonStorageInterfacePrx dataBasePrx
void clear(const ::Ice::Current &=Ice::emptyCurrent) override
MemoryUpdaterMap updaters
void print(const ::Ice::Current &=Ice::emptyCurrent) const override
WorkingMemoryUpdaterBasePrx getUpdater(const std::string &updaterName, const ::Ice::Current &=Ice::emptyCurrent) override
MongoSerializerPtr dbSerializer
std::string priorMemoryName
WorkingMemoryUpdaterBasePrx registerUpdater(const std::string &updaterName, const WorkingMemoryUpdaterBasePtr &updater, const ::Ice::Current &=Ice::emptyCurrent) override
PriorKnowledgeInterfacePrx priorKnowledgePrx
virtual void onConnectWorkingMemory()=0
WorkingMemoryListenerInterfacePrx listenerPrx
std::string longtermMemoryName
void onConnectComponent() override
Pure virtual hook for the subclass.
virtual void onInitWorkingMemory()=0
std::string updatesTopicName
LongtermMemoryInterfacePrx longtermMemoryPrx
void unregisterUpdater(const std::string &updaterName, const ::Ice::Current &=Ice::emptyCurrent) override
AbstractMemorySegmentPrx addSegment(const std::string &segmentName, const AbstractMemorySegmentPtr &segment, const ::Ice::Current &=Ice::emptyCurrent) override
MemorySegmentMap segments
std::shared_mutex segmentsMutex
#define ARMARX_INFO
The normal logging level.
::IceInternal::Handle<::Ice::Communicator > CommunicatorPtr
IceInternal::Handle< WorkingMemoryUpdater > WorkingMemoryUpdaterPtr