Yet Another Robot Platform
No Matches
yarp::os::impl::PortDataModifier Class Reference

This is the heart of a yarp port. More...

#include <yarp/os/impl/PortCore.h>

Public Member Functions

 PortDataModifier ()
virtual ~PortDataModifier ()
void releaseOutModifier ()
void releaseInModifier ()

Public Attributes

std::mutex outputMutex
std::mutex inputMutex

Detailed Description

This is the heart of a yarp port.

It is the thread manager. All other port components are insulated from threading. It maintains a collection of incoming and outgoing connections. Data coming from incoming connections is directed to the handler set with setReadHandler(). Calls to send() result in data being sent to all the outgoing connections. This class is used to construct yarp::os::Port, which in turn is used to construct yarp::os::BufferedPort and several other port variants.


The port's phase in its lifecycle is reflected by flags as follows.


The port is constructed in an inactive, dormant state. All flags off initially.

  • -listening -running -starting -closing -finished -finishing


A call to listen puts the port on the network

  • +listening (server now exists)


A call to start creates a thread to serve network requests

  • +starting
  • +running (set in server thread)
  • -starting (set in server thread)


A call to close winds everything down

  • +finishing
  • +closing
  • +finished (set in server thread)
  • -listening -running -starting -closing -finished -finishing

It is possible to create a port without creating a server for it, by using manualStart() rather than start(). Such ports don't get registered and are not reachable on the network, but can interact with other ports.


The port's connections are stored in the PortCore::units list. Input and output connections are stored in the same list, and a lot of the code does not distinguish them. Outgoing messages on the connections are tracked using the PortCore::packets list. A single message may be associated with many connections.

The yarp::os::impl::PortDataModifier class is a helper class to manage the port data modifiers

Definition at line 101 of file PortCore.h.

Constructor & Destructor Documentation

◆ PortDataModifier()

yarp::os::impl::PortDataModifier::PortDataModifier ( )

Definition at line 104 of file PortCore.h.

◆ ~PortDataModifier()

virtual yarp::os::impl::PortDataModifier::~PortDataModifier ( )

Definition at line 110 of file PortCore.h.

Member Function Documentation

◆ releaseInModifier()

void yarp::os::impl::PortDataModifier::releaseInModifier ( )

Definition at line 125 of file PortCore.h.

◆ releaseOutModifier()

void yarp::os::impl::PortDataModifier::releaseOutModifier ( )

Definition at line 116 of file PortCore.h.

Member Data Documentation

◆ inputModifier

yarp::os::Carrier* yarp::os::impl::PortDataModifier::inputModifier

Definition at line 136 of file PortCore.h.

◆ inputMutex

std::mutex yarp::os::impl::PortDataModifier::inputMutex

Definition at line 138 of file PortCore.h.

◆ outputModifier

yarp::os::Carrier* yarp::os::impl::PortDataModifier::outputModifier

Definition at line 135 of file PortCore.h.

◆ outputMutex

std::mutex yarp::os::impl::PortDataModifier::outputMutex

Definition at line 137 of file PortCore.h.

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