YARP
Yet Another Robot Platform
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

yarp::os::CarrieroutputModifier
 
yarp::os::CarrierinputModifier
 
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.

Phases

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

PortCore()

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

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

listen()

A call to listen puts the port on the network

  • +listening (server now exists)

start()

A call to start creates a thread to serve network requests

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

close()

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.

Connections

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 107 of file PortCore.h.

Constructor & Destructor Documentation

◆ PortDataModifier()

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

Definition at line 110 of file PortCore.h.

◆ ~PortDataModifier()

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

Definition at line 116 of file PortCore.h.

Member Function Documentation

◆ releaseInModifier()

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

Definition at line 131 of file PortCore.h.

◆ releaseOutModifier()

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

Definition at line 122 of file PortCore.h.

Member Data Documentation

◆ inputModifier

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

Definition at line 142 of file PortCore.h.

◆ inputMutex

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

Definition at line 144 of file PortCore.h.

◆ outputModifier

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

Definition at line 141 of file PortCore.h.

◆ outputMutex

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

Definition at line 143 of file PortCore.h.


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