YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::Nodes Class Reference

The Nodes class. More...

#include <yarp/os/Nodes.h>

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

Classes

class  Private
 

Public Member Functions

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

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 28 of file Nodes.h.

Constructor & Destructor Documentation

◆ Nodes()

Nodes::Nodes ( )

Definition at line 260 of file Nodes.cpp.

◆ ~Nodes()

Nodes::~Nodes ( )
virtual

Definition at line 265 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 270 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 335 of file Nodes.cpp.

◆ clear()

void Nodes::clear ( )

clear empties the container

Definition at line 295 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 290 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 325 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 300 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 305 of file Nodes.cpp.

◆ interrupt()

void Nodes::interrupt ( )

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

Definition at line 285 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 310 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 280 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 275 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 340 of file Nodes.cpp.

◆ requireActiveName()

bool Nodes::requireActiveName ( )

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

Returns
true

Definition at line 330 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 320 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 315 of file Nodes.cpp.


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