YARP
Yet Another Robot Platform
yarp::os::Nodes Class Reference

The Nodes class. More...

#include <yarp/os/Nodes.h>

+ Inheritance diagram for yarp::os::Nodes:

Detailed Description

The Nodes class.

A container for multiple nodes, keeping information about the currently active node. When a Publisher or a Subscriber is registered, a NestedContact will be created associating the topic to the active Node if present. The active Node is the last instantiated in temporal order. Instantiation of multiple Publisher/Subscriber associated with multiple Node is not thread safe.

Definition at line 34 of file Nodes.h.

Classes

class  Private
 

Public Member Functions

 Nodes ()
 
virtual ~Nodes ()
 
virtual void add (Contactable &contactable) override
 add a Contactable to the Node specified in the contactable name (see NestedContact.nodeName). More...
 
virtual void remove (Contactable &contactable) override
 remove a Contactable from the Node specified in the contactable's name. More...
 
virtual Contact query (const std::string &name, const std::string &category="") override
 query the list of Node to find a Contact with the specified name. More...
 
virtual void update (Contactable &contactable)
 update a Node information in this container. More...
 
Contact getParent (const std::string &name)
 getParent get info about node associated with the specified port. More...
 
Contact getURI (const std::string &name)
 getURI queries the Node specified in the name parameter to get Contact information about the specified port More...
 
void prepare (const std::string &name)
 prepare checks for the existence of the node specified in the name parameter. More...
 
void interrupt ()
 interrupt delegates interrupt call to all of the Node in this container. More...
 
bool enable (bool flag)
 enable setter for the activity state of the container. More...
 
void clear ()
 clear empties the container More...
 
void setActiveName (const std::string &name)
 setActiveName setter for the currently active node More...
 
void addExternalNode (const std::string &name, Node &node)
 addExternalNode adds a Node to this container. More...
 
void removeExternalNode (const std::string &name)
 removeExternalNode erase the node from the container. More...
 
std::string getActiveName ()
 getActiveName getter for the currently active node's name More...
 
bool requireActiveName ()
 requireActiveName if there is no active node, creates a temporary one. More...
 
- Public Member Functions inherited from yarp::os::Contactables
virtual ~Contactables ()
 

Constructor & Destructor Documentation

◆ Nodes()

Nodes::Nodes ( )

Definition at line 264 of file Nodes.cpp.

◆ ~Nodes()

Nodes::~Nodes ( )
virtual

Definition at line 269 of file Nodes.cpp.

Member Function Documentation

◆ add()

void Nodes::add ( Contactable contactable)
overridevirtual

add a Contactable to the Node specified in the contactable name (see NestedContact.nodeName).

If the specified node is in this container, add the contactable to it, otherwise firstly creates the node and add it to this container.

Parameters
contactableto be added

Implements yarp::os::Contactables.

Definition at line 274 of file Nodes.cpp.

◆ addExternalNode()

void Nodes::addExternalNode ( const std::string &  name,
Node node 
)

addExternalNode adds a Node to this container.

! Do NOT add two times the same Node.

Parameters
nameof the node to be added
nodeto be added

Definition at line 339 of file Nodes.cpp.

◆ clear()

void Nodes::clear ( )

clear empties the container

Definition at line 299 of file Nodes.cpp.

◆ enable()

bool Nodes::enable ( bool  flag)

enable setter for the activity state of the container.

If disabling (parameter is false) clears the container.

Parameters
flag
Returns
current activity state, after setting

Definition at line 294 of file Nodes.cpp.

◆ getActiveName()

std::string Nodes::getActiveName ( )

getActiveName getter for the currently active node's name

Returns
the currently active node's name.

Definition at line 329 of file Nodes.cpp.

◆ getParent()

Contact Nodes::getParent ( const std::string &  name)

getParent get info about node associated with the specified port.

Parameters
nameof a registered port (in the format /topic@/node)
Returns
Contact information about the /node port if found, empty Contact otherwise

Definition at line 304 of file Nodes.cpp.

◆ getURI()

Contact Nodes::getURI ( const std::string &  name)

getURI queries the Node specified in the name parameter to get Contact information about the specified port

Parameters
nameof a registered port (in the format /topic@/node)
Returns
Contact information about /topic@/node port or empty Contact

Definition at line 309 of file Nodes.cpp.

◆ interrupt()

void Nodes::interrupt ( )

interrupt delegates interrupt call to all of the Node in this container.

Definition at line 289 of file Nodes.cpp.

◆ prepare()

void Nodes::prepare ( const std::string &  name)

prepare checks for the existence of the node specified in the name parameter.

If the node doesn't exists, creates it. If the name parameter is not representing a NestedContact, does nothing.

Parameters
nameof a port in the format /topic@/node

Definition at line 314 of file Nodes.cpp.

◆ query()

Contact Nodes::query ( const std::string &  name,
const std::string &  category = "" 
)
overridevirtual

query the list of Node to find a Contact with the specified name.

Parameters
nameof the Contact (see NestedContact.nestedName)
categoryof the Contact (see NestedContact.category)
Returns
first matching Contact or an empty one

Implements yarp::os::Contactables.

Definition at line 284 of file Nodes.cpp.

◆ remove()

void Nodes::remove ( Contactable contactable)
overridevirtual

remove a Contactable from the Node specified in the contactable's name.

Parameters
contactableto be removed

Implements yarp::os::Contactables.

Definition at line 279 of file Nodes.cpp.

◆ removeExternalNode()

void Nodes::removeExternalNode ( const std::string &  name)

removeExternalNode erase the node from the container.

Parameters
nameof the Node to be removed

Definition at line 344 of file Nodes.cpp.

◆ requireActiveName()

bool Nodes::requireActiveName ( )

requireActiveName if there is no active node, creates a temporary one.

Returns
true

Definition at line 334 of file Nodes.cpp.

◆ setActiveName()

void Nodes::setActiveName ( const std::string &  name)

setActiveName setter for the currently active node

Parameters
nameof the Node to be set as active

Definition at line 324 of file Nodes.cpp.

◆ update()

void Nodes::update ( Contactable contactable)
virtual

update a Node information in this container.

Parameters
contactableto be updated

Definition at line 319 of file Nodes.cpp.


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