YARP
Yet Another Robot Platform
yarp::os::NameSpace Class Referenceabstract

An abstract name space for ports. More...

#include <yarp/os/NameSpace.h>

+ Inheritance diagram for yarp::os::NameSpace:

Public Member Functions

virtual ~NameSpace ()
 Destructor. More...
 
virtual bool checkNetwork ()
 Check if a name space is available. More...
 
virtual bool checkNetwork (double timeout)
 Check if a name space is available, with a timeout on any network operations needed. More...
 
virtual Contact getNameServerContact () const =0
 Get an address for a name server that manages the name space, if available. More...
 
virtual std::string getNameServerName () const
 Get the port name of a name server that manages the name space, if available. More...
 
virtual Contact queryName (const std::string &name)=0
 Map from port name to contact information. More...
 
virtual Contact registerName (const std::string &name)=0
 Record contact information to tie to a port name. More...
 
virtual Contact registerContact (const Contact &contact)=0
 Record contact information (should include a port name). More...
 
virtual Contact unregisterName (const std::string &name)=0
 Disassociate contact information from a port name. More...
 
virtual Contact unregisterContact (const Contact &contact)=0
 Disassociate contact information (should include a port name). More...
 
virtual Contact registerAdvanced (const Contact &contact, NameStore *store)
 Record contact information, with access to the contact information of other ports for cross-referencing. More...
 
virtual Contact unregisterAdvanced (const std::string &name, NameStore *store)
 Remove contact information, with access to the contact information of other ports for cross-referencing. More...
 
virtual bool setProperty (const std::string &name, const std::string &key, const Value &value)=0
 Associate a key/value pair with a named port. More...
 
virtual ValuegetProperty (const std::string &name, const std::string &key)=0
 Get the value of a named key from a named port. More...
 
virtual bool connectPortToTopic (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Publish a port to a topic. More...
 
virtual bool connectTopicToPort (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Subscribe a port to a topic. More...
 
virtual bool disconnectPortFromTopic (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Stop publishing a port to a topic. More...
 
virtual bool disconnectTopicFromPort (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Stop subscribing a port to a topic. More...
 
virtual bool connectPortToPortPersistently (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Connect two ports with persistence. More...
 
virtual bool disconnectPortToPortPersistently (const Contact &src, const Contact &dest, const ContactStyle &style)=0
 Disconnect two ports, removing any persistence. More...
 
virtual bool localOnly () const =0
 Check if the NameSpace is only valid for the current process ("local"). More...
 
virtual bool usesCentralServer () const =0
 Check if a central server is involved in managing the NameSpace. More...
 
virtual bool serverAllocatesPortNumbers () const =0
 Check if a central server is responsible for allocating port numbers, or if this should be left up to the operating system. More...
 
virtual bool connectionHasNameOfEndpoints () const =0
 When connections are made involving ports managed by this NameSpace do the ports involved end up knowing the names of their counterparties? More...
 
virtual Contact detectNameServer (bool useDetectedServer, bool &scanNeeded, bool &serverUsed)=0
 Find a name server for this NameSpace, if applicable. More...
 
virtual bool writeToNameServer (PortWriter &cmd, PortReader &reply, const ContactStyle &style)=0
 Write a message to a name server for this NameSpace, if applicable. More...
 

Detailed Description

An abstract name space for ports.

This collects all the services we may ask of a name server, to simplify plugging in alternate implementations.

Definition at line 25 of file NameSpace.h.

Constructor & Destructor Documentation

◆ ~NameSpace()

NameSpace::~NameSpace ( )
virtualdefault

Destructor.

Member Function Documentation

◆ checkNetwork() [1/2]

bool NameSpace::checkNetwork ( )
virtual

Check if a name space is available.

Returns
true if the name space is available, false otherwise.

Definition at line 20 of file NameSpace.cpp.

◆ checkNetwork() [2/2]

bool NameSpace::checkNetwork ( double  timeout)
virtual

Check if a name space is available, with a timeout on any network operations needed.

If the timeout occurs, we assume the name space is not available.

Parameters
[in]timeouttime in seconds to wait for a response in any network operation needed.
Returns
true if the name server is available in the specified time, false otherwise.

Definition at line 43 of file NameSpace.cpp.

◆ connectionHasNameOfEndpoints()

virtual bool yarp::os::NameSpace::connectionHasNameOfEndpoints ( ) const
pure virtual

When connections are made involving ports managed by this NameSpace do the ports involved end up knowing the names of their counterparties?

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ connectPortToPortPersistently()

virtual bool yarp::os::NameSpace::connectPortToPortPersistently ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Connect two ports with persistence.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ connectPortToTopic()

virtual bool yarp::os::NameSpace::connectPortToTopic ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Publish a port to a topic.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ connectTopicToPort()

virtual bool yarp::os::NameSpace::connectTopicToPort ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Subscribe a port to a topic.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ detectNameServer()

virtual Contact yarp::os::NameSpace::detectNameServer ( bool  useDetectedServer,
bool &  scanNeeded,
bool &  serverUsed 
)
pure virtual

Find a name server for this NameSpace, if applicable.

Parameters
useDetectedServeruse any server found for future queries.
scanNeededset to true if a search was needed, rather than finding a name server based on cached hints.
serverUsedset to true if a server was found and marked for use in future queries.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ disconnectPortFromTopic()

virtual bool yarp::os::NameSpace::disconnectPortFromTopic ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Stop publishing a port to a topic.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ disconnectPortToPortPersistently()

virtual bool yarp::os::NameSpace::disconnectPortToPortPersistently ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Disconnect two ports, removing any persistence.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ disconnectTopicFromPort()

virtual bool yarp::os::NameSpace::disconnectTopicFromPort ( const Contact src,
const Contact dest,
const ContactStyle style 
)
pure virtual

Stop subscribing a port to a topic.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ getNameServerContact()

virtual Contact yarp::os::NameSpace::getNameServerContact ( ) const
pure virtual

Get an address for a name server that manages the name space, if available.

Implemented in yarp::os::YarpDummyNameSpace, yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ getNameServerName()

std::string NameSpace::getNameServerName ( ) const
virtual

Get the port name of a name server that manages the name space, if available.

Definition at line 67 of file NameSpace.cpp.

◆ getProperty()

virtual Value* yarp::os::NameSpace::getProperty ( const std::string &  name,
const std::string &  key 
)
pure virtual

Get the value of a named key from a named port.

Returns
nullptr if no value was set for the named key.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ localOnly()

virtual bool yarp::os::NameSpace::localOnly ( ) const
pure virtual

Check if the NameSpace is only valid for the current process ("local").

Implemented in yarp::os::YarpDummyNameSpace, yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ queryName()

virtual Contact yarp::os::NameSpace::queryName ( const std::string &  name)
pure virtual

Map from port name to contact information.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ registerAdvanced()

virtual Contact yarp::os::NameSpace::registerAdvanced ( const Contact contact,
NameStore store 
)
inlinevirtual

Record contact information, with access to the contact information of other ports for cross-referencing.

Parameters
contactthe contact information to record
storean interface to port information as presented via the YARP client API (as opposed to what a single NameSpace would have access to).

Reimplemented in yarp::os::RosNameSpace.

Definition at line 96 of file NameSpace.h.

◆ registerContact()

virtual Contact yarp::os::NameSpace::registerContact ( const Contact contact)
pure virtual

Record contact information (should include a port name).

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ registerName()

virtual Contact yarp::os::NameSpace::registerName ( const std::string &  name)
pure virtual

Record contact information to tie to a port name.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ serverAllocatesPortNumbers()

virtual bool yarp::os::NameSpace::serverAllocatesPortNumbers ( ) const
pure virtual

Check if a central server is responsible for allocating port numbers, or if this should be left up to the operating system.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ setProperty()

virtual bool yarp::os::NameSpace::setProperty ( const std::string &  name,
const std::string &  key,
const Value value 
)
pure virtual

Associate a key/value pair with a named port.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ unregisterAdvanced()

virtual Contact yarp::os::NameSpace::unregisterAdvanced ( const std::string &  name,
NameStore store 
)
inlinevirtual

Remove contact information, with access to the contact information of other ports for cross-referencing.

Reimplemented in yarp::os::RosNameSpace.

Definition at line 107 of file NameSpace.h.

◆ unregisterContact()

virtual Contact yarp::os::NameSpace::unregisterContact ( const Contact contact)
pure virtual

Disassociate contact information (should include a port name).

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ unregisterName()

virtual Contact yarp::os::NameSpace::unregisterName ( const std::string &  name)
pure virtual

Disassociate contact information from a port name.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ usesCentralServer()

virtual bool yarp::os::NameSpace::usesCentralServer ( ) const
pure virtual

Check if a central server is involved in managing the NameSpace.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.

◆ writeToNameServer()

virtual bool yarp::os::NameSpace::writeToNameServer ( PortWriter cmd,
PortReader reply,
const ContactStyle style 
)
pure virtual

Write a message to a name server for this NameSpace, if applicable.

Messages are name-server-specific.

Implemented in yarp::os::YarpNameSpace, yarp::os::RosNameSpace, and yarp::os::MultiNameSpace.


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