YARP  2.3.70.2
Yet Another Robot Platform
yarp::os::Connection Class Referenceabstract

A controller for an individual connection. More...

#include <yarp/os/Connection.h>

+ Inheritance diagram for yarp::os::Connection:

Public Member Functions

virtual ~Connection ()
 Destructor. More...
 
virtual bool isValid ()
 Check if this object is really a connection, or just an empty placeholder. More...
 
virtual bool isTextMode ()=0
 Check if carrier is textual in nature. More...
 
virtual bool isBareMode ()
 Check if carrier excludes type information from payload. More...
 
virtual void handleEnvelope (const yarp::os::ConstString &envelope)=0
 Carriers that do not distinguish data from administrative headers (i.e. More...
 
virtual bool canEscape ()=0
 Check if carrier can encode administrative messages, as opposed to just user data. More...
 
virtual bool requireAck ()=0
 Check if carrier has flow control, requiring sent messages to be acknowledged by recipient. More...
 
virtual bool supportReply ()=0
 This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies. More...
 
virtual bool isLocal ()=0
 Check if carrier operates within a single process. More...
 
virtual bool isPush ()=0
 Check if carrier is "push" or "pull" style. More...
 
virtual bool isConnectionless ()=0
 Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp). More...
 
virtual bool isBroadcast ()=0
 Check if this carrier uses a broadcast mechanism. More...
 
virtual bool isActive ()=0
 Check if carrier is alive and error free. More...
 
virtual bool modifiesIncomingData ()=0
 Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method. More...
 
virtual yarp::os::ConnectionReadermodifyIncomingData (yarp::os::ConnectionReader &reader)=0
 Modify incoming payload data, if appropriate. More...
 
virtual bool acceptIncomingData (yarp::os::ConnectionReader &reader)=0
 Determine whether incoming data should be accepted. More...
 
virtual bool modifiesOutgoingData ()=0
 Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method. More...
 
virtual PortWritermodifyOutgoingData (PortWriter &writer)=0
 Modify outgoing payload data, if appropriate. More...
 
virtual bool acceptOutgoingData (PortWriter &writer)=0
 Determine whether outgoing data should be accepted. More...
 
virtual bool modifiesReply ()=0
 Check if this carrier modifies outgoing data through the Carrier::modifyReply method. More...
 
virtual PortReadermodifyReply (PortReader &reader)=0
 Modify reply payload data, if appropriate. More...
 
virtual void setCarrierParams (const yarp::os::Property &params)=0
 Configure carrier from port administrative commands. More...
 
virtual void getCarrierParams (yarp::os::Property &params)=0
 Get carrier configuration and deliver it by port administrative commands. More...
 
virtual void getHeader (const yarp::os::Bytes &header)=0
 Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to select it. More...
 
virtual void prepareDisconnect ()=0
 Do cleanup and preparation for the coming disconnect, if necessary. More...
 
virtual yarp::os::ConstString getName ()=0
 Get the name of this connection type ("tcp", "mcast", "shmem", ...) More...
 

Detailed Description

A controller for an individual connection.

A bundle of callbacks that defines how the connection behaves.

Definition at line 25 of file Connection.h.

Constructor & Destructor Documentation

◆ ~Connection()

virtual yarp::os::Connection::~Connection ( )
inlinevirtual

Destructor.

Definition at line 32 of file Connection.h.

Member Function Documentation

◆ acceptIncomingData()

virtual bool yarp::os::Connection::acceptIncomingData ( yarp::os::ConnectionReader reader)
pure virtual

Determine whether incoming data should be accepted.

Parameters
readerfor incoming data.
Returns
true if data should be accepted, false if it should be discarded.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, yarp::os::PriorityCarrier, and yarp::os::PortMonitor.

◆ acceptOutgoingData()

virtual bool yarp::os::Connection::acceptOutgoingData ( PortWriter writer)
pure virtual

Determine whether outgoing data should be accepted.

Parameters
writerfor outgoing data.
Returns
true if data should be accepted, false if it should be discarded.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::PortMonitor.

◆ canEscape()

virtual bool yarp::os::Connection::canEscape ( )
pure virtual

Check if carrier can encode administrative messages, as opposed to just user data.

The word escape is used in the sense of escape character or escape sequence here.

Returns
true if carrier can encode administrative messages

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, yarp::os::TcpRosCarrier, yarp::os::impl::LocalCarrier, yarp::os::XmlRpcCarrier, yarp::os::impl::NameserCarrier, yarp::os::MjpegCarrier, yarp::os::MpiCarrier, yarp::os::AbstractCarrier, and HumanCarrier.

◆ getCarrierParams()

virtual void yarp::os::Connection::getCarrierParams ( yarp::os::Property params)
pure virtual

Get carrier configuration and deliver it by port administrative commands.

Parameters
paramsoutput carrier properties

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, yarp::os::PriorityCarrier, yarp::os::PortMonitor, yarp::os::AbstractCarrier, and yarp::os::ModifyingCarrier.

◆ getHeader()

virtual void yarp::os::Connection::getHeader ( const yarp::os::Bytes header)
pure virtual

◆ getName()

◆ handleEnvelope()

virtual void yarp::os::Connection::handleEnvelope ( const yarp::os::ConstString envelope)
pure virtual

Carriers that do not distinguish data from administrative headers (i.e.

canEscape returns false), can overload this method to handle the envelope inside the stream. On the receiving side, the InputStream will have to overload the yarp::os::InputStream::setReadEnvelopeCallback method, and execute the callback as soon as the envelope is ready.

Parameters
envelopethe envelope to transmit bundled with data.

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, and yarp::os::MjpegCarrier.

◆ isActive()

virtual bool yarp::os::Connection::isActive ( )
pure virtual

◆ isBareMode()

virtual bool yarp::os::Connection::isBareMode ( )
inlinevirtual

Check if carrier excludes type information from payload.

Returns
true if carrier is bare

Reimplemented in ForwardingCarrier, yarp::os::BayerCarrier, and yarp::os::TcpRosCarrier.

Definition at line 56 of file Connection.h.

◆ isBroadcast()

virtual bool yarp::os::Connection::isBroadcast ( )
pure virtual

Check if this carrier uses a broadcast mechanism.

This flag is used to determine whether it is appropriate to send "kill" messages using a carrier or whether they should be sent "out-of-band"

Returns
true if carrier uses a broadcast mechanism.

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, yarp::os::impl::McastCarrier, and yarp::os::MpiBcastCarrier.

◆ isConnectionless()

virtual bool yarp::os::Connection::isConnectionless ( )
pure virtual

Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).

This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies. Replies are not supported by YARP on connectionless carriers.

Returns
true if carrier is connectionless

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, yarp::os::impl::LocalCarrier, yarp::os::TcpRosCarrier, yarp::os::XmlRpcCarrier, yarp::os::MjpegCarrier, yarp::os::MpiCarrier, yarp::os::impl::ShmemCarrier, yarp::os::impl::UdpCarrier, yarp::os::impl::TcpCarrier, yarp::os::AbstractCarrier, and HumanCarrier.

◆ isLocal()

virtual bool yarp::os::Connection::isLocal ( )
pure virtual

Check if carrier operates within a single process.

In such a case, YARP connections may get completely reorganized in order to optimize them.

Returns
true if carrier will only operate within a single process

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, yarp::os::TcpRosCarrier, yarp::os::XmlRpcCarrier, yarp::os::impl::LocalCarrier, yarp::os::MjpegCarrier, HumanCarrier, and yarp::os::AbstractCarrier.

◆ isPush()

virtual bool yarp::os::Connection::isPush ( )
pure virtual

Check if carrier is "push" or "pull" style.

Push means that the side that initiates a connection is also the one that will sending of data or commands. All native YARP connections are like this. A "pull" style is equivalent to automatically sending a "reverse connection" port command at the start of the connection.

Returns
true if carrier is "push" style, false if "pull" style

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, yarp::os::TcpRosCarrier, and yarp::os::MjpegCarrier.

◆ isTextMode()

virtual bool yarp::os::Connection::isTextMode ( )
pure virtual

◆ isValid()

virtual bool yarp::os::Connection::isValid ( )
inlinevirtual

Check if this object is really a connection, or just an empty placeholder.

Returns
true if a valid connection

Reimplemented in ForwardingCarrier, yarp::os::NullConnection, and yarp::os::BayerCarrier.

Definition at line 42 of file Connection.h.

◆ modifiesIncomingData()

virtual bool yarp::os::Connection::modifiesIncomingData ( )
pure virtual

Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.

Returns
true if carrier wants Carrier::modifyIncomingData called.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::ModifyingCarrier.

◆ modifiesOutgoingData()

virtual bool yarp::os::Connection::modifiesOutgoingData ( )
pure virtual

Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.

Returns
true if carrier wants Carrier::modifyOutgoingData called.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::ModifyingCarrier.

◆ modifiesReply()

virtual bool yarp::os::Connection::modifiesReply ( )
pure virtual

Check if this carrier modifies outgoing data through the Carrier::modifyReply method.

Returns
true if carrier wants Carrier::modifyReply called.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::ModifyingCarrier.

◆ modifyIncomingData()

virtual yarp::os::ConnectionReader& yarp::os::Connection::modifyIncomingData ( yarp::os::ConnectionReader reader)
pure virtual

Modify incoming payload data, if appropriate.

Doesn't need to be done immediately, it is fine to hold onto a reference to the incoming data reader and use it on demand. This can be handy in order to avoid unnecessary copies.

Parameters
readerfor incoming data.
Returns
reader for modified version of incoming data.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, yarp::os::BayerCarrier, and yarp::os::PortMonitor.

◆ modifyOutgoingData()

virtual PortWriter& yarp::os::Connection::modifyOutgoingData ( PortWriter writer)
pure virtual

Modify outgoing payload data, if appropriate.

Doesn't need to be done immediately, it is fine to hold onto a reference to the outgoing data reader and use it on demand. This can be handy in order to avoid unnecessary copies.

Parameters
writerfor outgoing data.
Returns
writer for modified version of outgoing data.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::PortMonitor.

◆ modifyReply()

virtual PortReader& yarp::os::Connection::modifyReply ( PortReader reader)
pure virtual

Modify reply payload data, if appropriate.

Parameters
readerfor the replied message.
Returns
reader for modified version of the replied message.

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, and yarp::os::PortMonitor.

◆ prepareDisconnect()

virtual void yarp::os::Connection::prepareDisconnect ( )
pure virtual

Do cleanup and preparation for the coming disconnect, if necessary.

Implemented in ForwardingCarrier, yarp::os::NullConnection, yarp::os::Carrier, and yarp::os::MpiBcastCarrier.

◆ requireAck()

virtual bool yarp::os::Connection::requireAck ( )
pure virtual

◆ setCarrierParams()

virtual void yarp::os::Connection::setCarrierParams ( const yarp::os::Property params)
pure virtual

Configure carrier from port administrative commands.

Parameters
paramscarrier properties

Implemented in ForwardingCarrier, yarp::os::Carrier, yarp::os::NullConnection, yarp::os::PriorityCarrier, yarp::os::PortMonitor, yarp::os::AbstractCarrier, and yarp::os::ModifyingCarrier.

◆ supportReply()

virtual bool yarp::os::Connection::supportReply ( )
pure virtual

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