MemoryNameSystem Class Reference

The memory name system (MNS) client. More...

#include <RobotAPI/libraries/armem/client/MemoryNameSystem.h>

+ Inheritance diagram for MemoryNameSystem:

Public Member Functions

std::map< std::string, ConfiguratorgetAllConfigurators () const
 Get Configurators for all registered servers (without updating).
 
std::map< std::string, ConfiguratorgetAllConfigurators (bool update=true)
 Get Configurators for all registered servers.
 
std::map< std::string, LoadergetAllLoaders () const
 Get Loaders for all registered servers (without updating).
 
std::map< std::string, LoadergetAllLoaders (bool update=true)
 Get Loaders for all registered servers.
 
std::map< std::string, ReadergetAllReaders () const
 Get Readers for all registered servers (without updating).
 
std::map< std::string, ReadergetAllReaders (bool update=true)
 Get Readers for all registered servers.
 
std::map< std::string, WritergetAllWriters () const
 Get Writers for all registered servers (without updating).
 
std::map< std::string, WritergetAllWriters (bool update=true)
 Get Writers for all registered servers.
 
Configurator getConfigurator (const MemoryID &memoryID)
 Get a configurator to the given memory name.
 
Loader getLoader (const MemoryID &memoryID)
 
mns::MemoryNameSystemInterfacePrx getMemoryNameSystem () const
 
void getMemoryNameSystem (mns::MemoryNameSystemInterfacePrx mns)
 
Reader getReader (const MemoryID &memoryID)
 Get a reader to the given memory name.
 
Writer getWriter (const MemoryID &memoryID)
 Get a writer to the given memory name.
 
void initialize (mns::MemoryNameSystemInterfacePrx mns, ManagedIceObject *component=nullptr)
 
 MemoryNameSystem ()
 
 MemoryNameSystem (mns::MemoryNameSystemInterfacePrx mns, ManagedIceObject *component=nullptr)
 Construct an MNS client.
 
 operator bool () const
 Indicate whether the proxy is set.
 
void registerServer (const MemoryID &memoryID, mns::dto::MemoryServerInterfaces server)
 Register a memory server in the MNS.
 
void removeServer (const MemoryID &memoryID)
 Remove a memory server from the MNS.
 
std::optional< wm::EntityInstanceresolveEntityInstance (const MemoryID &id)
 Resolve a memory ID to an EntityInstance.
 
std::map< MemoryID, wm::EntityInstanceresolveEntityInstances (const std::vector< MemoryID > &ids)
 
mns::dto::MemoryServerInterfaces resolveServer (const MemoryID &memoryID)
 Resolve the given memory server for the given memory ID.
 
void setComponent (ManagedIceObject *component)
 
void update ()
 Update the internal registry to the data in the MNS.
 
Configurator useConfigurator (const MemoryID &memoryID)
 Use a memory server and get a configurator for it.
 
Configurator useConfigurator (const MemoryID &memoryID, ManagedIceObject &component)
 
Configurator useConfigurator (const std::string &memoryName)
 
Configurator useConfigurator (const std::string &memoryName, ManagedIceObject &component)
 
Loader useLoader (const MemoryID &memoryID)
 Use a memory server and get a configurator for it.
 
Loader useLoader (const MemoryID &memoryID, ManagedIceObject &component)
 
Loader useLoader (const std::string &memoryName)
 
Loader useLoader (const std::string &memoryName, ManagedIceObject &component)
 
Reader useReader (const MemoryID &memoryID)
 Use a memory server and get a reader for it.
 
Reader useReader (const MemoryID &memoryID, ManagedIceObject &component)
 
Reader useReader (const std::string &memoryName)
 
Reader useReader (const std::string &memoryName, ManagedIceObject &component)
 
Writer useWriter (const MemoryID &memoryID)
 Use a memory server and get a writer for it.
 
Writer useWriter (const MemoryID &memoryID, ManagedIceObject &component)
 
Writer useWriter (const std::string &memoryName)
 
Writer useWriter (const std::string &memoryName, ManagedIceObject &component)
 
- Public Member Functions inherited from MemoryListener
 MemoryListener (ManagedIceObject *component=nullptr)
 
void setComponent (ManagedIceObject *component)
 
SubscriptionHandle subscribe (const MemoryID &subscriptionID, Callback Callback)
 
SubscriptionHandle subscribe (const MemoryID &subscriptionID, CallbackUpdatedOnly Callback)
 
template<class CalleeT>
SubscriptionHandle subscribe (const MemoryID &subscriptionID, CalleeT *callee, MemberCallback< CalleeT > callback)
 Subscribe with a class member function:
 
template<class CalleeT>
SubscriptionHandle subscribe (const MemoryID &subscriptionID, CalleeT *callee, MemberCallbackUpdatedOnly< CalleeT > callback)
 
void unsubscribe (SubscriptionHandle &subscriptionHandle)
 
void updated (const std::vector< data::MemoryID > &updatedIDs) const
 
void updated (const std::vector< MemoryID > &updatedIDs) const
 Function handling updates from the MemoryListener ice topic.
 

Additional Inherited Members

- Public Types inherited from MemoryListener
using Callback
 
using CallbackUpdatedOnly
 
template<class CalleeT>
using MemberCallback
 
template<class CalleeT>
using MemberCallbackUpdatedOnly
 
- Static Public Member Functions inherited from MemoryListener
static std::string MakeMemoryTopicName (const MemoryID &memoryID)
 
- Protected Attributes inherited from MemoryListener
std::unordered_map< MemoryID, std::vector< ManagedCallback > > callbacks
 
std::unordered_map< std::string, int > memoryRefCount
 memoryName -> callbacks needing memory topic
 
long nextId = 0
 
std::mutex subscribeMutex
 

Detailed Description

The memory name system (MNS) client.

This client class serves provides the MNS interface and is a local cache of the MNS registry. It can be used to resolve memory servers by their memory ID and to construct client::Readers and client::Writers.

During server resolution, it first consults the locally cached registry. If the memory server is not known locally, the local registry is updated to that of the remote MNS before trying again.

In addition, the MNS client can be used to send queries over multiple memory servers, as well as retrieving the data for arbitrary entity or entity snapshot IDs.

Definition at line 73 of file MemoryNameSystem.h.

Constructor & Destructor Documentation

◆ MemoryNameSystem() [1/2]

Definition at line 31 of file MemoryNameSystem.cpp.

◆ MemoryNameSystem() [2/2]

MemoryNameSystem ( mns::MemoryNameSystemInterfacePrx mns,
ManagedIceObject * component = nullptr )

Construct an MNS client.

Parameters
mnsThe MNS proxy.
componentThe owning component. When using a memory server, dependencies will be added to this component.

Definition at line 35 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ getAllConfigurators() [1/2]

std::map< std::string, Configurator > getAllConfigurators ( ) const

Get Configurators for all registered servers (without updating).

Returns
The configurators.

Definition at line 424 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllConfigurators() [2/2]

std::map< std::string, Configurator > getAllConfigurators ( bool update = true)

Get Configurators for all registered servers.

Parameters
updateIf true, perform an update first.
Returns
The configurators.

Definition at line 413 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllLoaders() [1/2]

std::map< std::string, Loader > getAllLoaders ( ) const

Get Loaders for all registered servers (without updating).

Returns
The loaders.

Definition at line 407 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllLoaders() [2/2]

std::map< std::string, Loader > getAllLoaders ( bool update = true)

Get Loaders for all registered servers.

Parameters
updateIf true, perform an update first.
Returns
The loaders.

Definition at line 396 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllReaders() [1/2]

std::map< std::string, Reader > getAllReaders ( ) const

Get Readers for all registered servers (without updating).

Returns
The readers.

Definition at line 441 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllReaders() [2/2]

std::map< std::string, Reader > getAllReaders ( bool update = true)

Get Readers for all registered servers.

Parameters
updateIf true, perform an update first.
Returns
The readers.

Definition at line 430 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllWriters() [1/2]

std::map< std::string, Writer > getAllWriters ( ) const

Get Writers for all registered servers (without updating).

Returns
The writers.

Definition at line 487 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getAllWriters() [2/2]

std::map< std::string, Writer > getAllWriters ( bool update = true)

Get Writers for all registered servers.

Parameters
updateIf true, perform an update first.
Returns
The writers.

Definition at line 477 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getConfigurator()

Configurator getConfigurator ( const MemoryID & memoryID)

Get a configurator to the given memory name.

Parameters
memoryIDThe memory ID.
Returns
The reader.
Exceptions
`error::CouldNotResolveMemoryServer`If the memory name could not be resolved.

Definition at line 228 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getLoader()

Loader getLoader ( const MemoryID & memoryID)

Definition at line 261 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ getMemoryNameSystem() [1/2]

mns::MemoryNameSystemInterfacePrx getMemoryNameSystem ( ) const

Definition at line 617 of file MemoryNameSystem.cpp.

◆ getMemoryNameSystem() [2/2]

void getMemoryNameSystem ( mns::MemoryNameSystemInterfacePrx mns)

Definition at line 623 of file MemoryNameSystem.cpp.

◆ getReader()

Reader getReader ( const MemoryID & memoryID)

Get a reader to the given memory name.

Parameters
memoryIDThe memory ID.
Returns
The reader.
Exceptions
`error::CouldNotResolveMemoryServer`If the memory name could not be resolved.

Definition at line 294 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWriter()

Writer getWriter ( const MemoryID & memoryID)

Get a writer to the given memory name.

Parameters
memoryIDThe memory ID.
Returns
The writer.
Exceptions
`error::CouldNotResolveMemoryServer`If the memory name could not be resolved.

Definition at line 447 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initialize()

void initialize ( mns::MemoryNameSystemInterfacePrx mns,
ManagedIceObject * component = nullptr )

Definition at line 42 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ operator bool()

operator bool ( ) const
inline

Indicate whether the proxy is set.

Definition at line 278 of file MemoryNameSystem.h.

◆ registerServer()

void registerServer ( const MemoryID & memoryID,
mns::dto::MemoryServerInterfaces server )

Register a memory server in the MNS.

Parameters
memoryIDThe memoryID.
serverThe memory server proxy.
Exceptions
`error::ServerRegistrationOrRemovalFailed`If the registration failed.

Definition at line 581 of file MemoryNameSystem.cpp.

◆ removeServer()

void removeServer ( const MemoryID & memoryID)

Remove a memory server from the MNS.

Parameters
memoryIDThe memoryID.
Exceptions
`error::ServerRegistrationOrRemovalFailed`If the removal failed.

Definition at line 603 of file MemoryNameSystem.cpp.

◆ resolveEntityInstance()

std::optional< wm::EntityInstance > resolveEntityInstance ( const MemoryID & id)

Resolve a memory ID to an EntityInstance.

The ID can refer to an entity, an entity snapshot, or an entity instance. When not referring to an entity instance, the latest snapshot and first instance will be queried.

Parameters
idThe entity, snapshot or instance ID.
Returns

Definition at line 493 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ resolveEntityInstances()

std::map< MemoryID, wm::EntityInstance > resolveEntityInstances ( const std::vector< MemoryID > & ids)

Definition at line 507 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveServer()

mns::dto::MemoryServerInterfaces resolveServer ( const MemoryID & memoryID)

Resolve the given memory server for the given memory ID.

Parameters
memoryIDThe memory ID.
Returns
The memory server proxy.
Exceptions
`error::CouldNotResolveMemoryServer`If the memory name could not be resolved.

Definition at line 145 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setComponent()

void setComponent ( ManagedIceObject * component)

Definition at line 629 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

void update ( )

Update the internal registry to the data in the MNS.

Exceptions
`error::MemoryNameSystemQueryFailed`If the call to the MNS failed.

Definition at line 49 of file MemoryNameSystem.cpp.

+ Here is the caller graph for this function:

◆ useConfigurator() [1/4]

Configurator useConfigurator ( const MemoryID & memoryID)

Use a memory server and get a configurator for it.

Definition at line 235 of file MemoryNameSystem.cpp.

+ Here is the caller graph for this function:

◆ useConfigurator() [2/4]

Configurator useConfigurator ( const MemoryID & memoryID,
ManagedIceObject & component )

Definition at line 242 of file MemoryNameSystem.cpp.

◆ useConfigurator() [3/4]

Configurator useConfigurator ( const std::string & memoryName)

Definition at line 249 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useConfigurator() [4/4]

Configurator useConfigurator ( const std::string & memoryName,
ManagedIceObject & component )

Definition at line 255 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useLoader() [1/4]

Loader useLoader ( const MemoryID & memoryID)

Use a memory server and get a configurator for it.

Definition at line 268 of file MemoryNameSystem.cpp.

+ Here is the caller graph for this function:

◆ useLoader() [2/4]

Loader useLoader ( const MemoryID & memoryID,
ManagedIceObject & component )

Definition at line 275 of file MemoryNameSystem.cpp.

◆ useLoader() [3/4]

Loader useLoader ( const std::string & memoryName)

Definition at line 282 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useLoader() [4/4]

Loader useLoader ( const std::string & memoryName,
ManagedIceObject & component )

Definition at line 288 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useReader() [1/4]

Reader useReader ( const MemoryID & memoryID)

Use a memory server and get a reader for it.

Definition at line 301 of file MemoryNameSystem.cpp.

+ Here is the caller graph for this function:

◆ useReader() [2/4]

Reader useReader ( const MemoryID & memoryID,
ManagedIceObject & component )

Definition at line 308 of file MemoryNameSystem.cpp.

◆ useReader() [3/4]

Reader useReader ( const std::string & memoryName)

Definition at line 315 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useReader() [4/4]

Reader useReader ( const std::string & memoryName,
ManagedIceObject & component )

Definition at line 321 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useWriter() [1/4]

Writer useWriter ( const MemoryID & memoryID)

Use a memory server and get a writer for it.

Definition at line 453 of file MemoryNameSystem.cpp.

+ Here is the caller graph for this function:

◆ useWriter() [2/4]

Writer useWriter ( const MemoryID & memoryID,
ManagedIceObject & component )

Definition at line 459 of file MemoryNameSystem.cpp.

◆ useWriter() [3/4]

Writer useWriter ( const std::string & memoryName)

Definition at line 465 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

◆ useWriter() [4/4]

Writer useWriter ( const std::string & memoryName,
ManagedIceObject & component )

Definition at line 471 of file MemoryNameSystem.cpp.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: