YARP  2.3.70.2
Yet Another Robot Platform
yarp::os::WireLink Class Reference

IDL-friendly object state, used in YARP to set up a port association. More...

#include <yarp/os/WireLink.h>

Public Member Functions

 WireLink ()
 
bool isValid () const
 Check if there is an association of some kind set up for this WireLink. More...
 
bool setOwner (yarp::os::PortReader &owner)
 Set the owner of this WireLink. More...
 
bool attachAsClient (yarp::os::UnbufferedContactable &port)
 Tag this WireLink as a client, sending data via the specified port. More...
 
bool attachAsClient (yarp::os::PortReader &reader)
 Tag this WireLink as a client, sending data via the specified reader. More...
 
bool attachAsServer (yarp::os::UnbufferedContactable &port)
 Tag this WireLink as a server, receiving commands via the specified port. More...
 
bool setStreamingMode (bool streaming)
 For a client WireLink, control whether replies to commands are expected. More...
 
bool write (PortWriter &writer)
 Write a message to the associated port or reader. More...
 
bool write (PortWriter &writer, PortReader &reader)
 Write a message to the associated port or reader, and read a reply. More...
 
bool callback (PortWriter &writer, PortReader &reader, const ConstString &tag="")
 Put a message in a stack to call later, asynchronously. More...
 
bool canWrite () const
 
bool canRead () const
 

Private Member Functions

bool attach (yarp::os::UnbufferedContactable &port, const yarp::os::ContactStyle &style)
 
void reset ()
 

Private Attributes

yarp::os::UnbufferedContactableport
 
yarp::os::PortReaderreader
 
yarp::os::PortReaderowner
 
yarp::os::MessageStack stack
 
bool replies
 
bool can_write
 
bool can_read
 

Detailed Description

IDL-friendly object state, used in YARP to set up a port association.

Definition at line 27 of file WireLink.h.

Constructor & Destructor Documentation

◆ WireLink()

yarp::os::WireLink::WireLink ( )
inline

Definition at line 54 of file WireLink.h.

Member Function Documentation

◆ attach()

bool yarp::os::WireLink::attach ( yarp::os::UnbufferedContactable port,
const yarp::os::ContactStyle style 
)
inlineprivate

Definition at line 37 of file WireLink.h.

◆ attachAsClient() [1/2]

bool yarp::os::WireLink::attachAsClient ( yarp::os::UnbufferedContactable port)
inline

Tag this WireLink as a client, sending data via the specified port.

Parameters
portthe port to use when sending data.
Returns
true on success

Definition at line 87 of file WireLink.h.

◆ attachAsClient() [2/2]

bool yarp::os::WireLink::attachAsClient ( yarp::os::PortReader reader)
inline

Tag this WireLink as a client, sending data via the specified reader.

Parameters
readerthe reader to use when sending data.
Returns
true on success

Definition at line 103 of file WireLink.h.

◆ attachAsServer()

bool yarp::os::WireLink::attachAsServer ( yarp::os::UnbufferedContactable port)
inline

Tag this WireLink as a server, receiving commands via the specified port.

Parameters
portthe port to monitor for commands.
Returns
true on success

Definition at line 118 of file WireLink.h.

◆ callback()

bool yarp::os::WireLink::callback ( PortWriter writer,
PortReader reader,
const ConstString tag = "" 
)
inline

Put a message in a stack to call later, asynchronously.

Used in implementation of thrift "oneway" messages.

Parameters
writermessage to send
readerwhere to send the message
tagstring to prefix the message with
Returns
true on success

Definition at line 188 of file WireLink.h.

◆ canRead()

bool yarp::os::WireLink::canRead ( ) const
inline
Returns
true if reading from the link is allowed.

Definition at line 209 of file WireLink.h.

◆ canWrite()

bool yarp::os::WireLink::canWrite ( ) const
inline
Returns
true if writing is allowed over link.

Definition at line 199 of file WireLink.h.

◆ isValid()

bool yarp::os::WireLink::isValid ( ) const
inline

Check if there is an association of some kind set up for this WireLink.

If not, data has nowhere to go.

Returns
True iff there is an association.

Definition at line 64 of file WireLink.h.

◆ reset()

void yarp::os::WireLink::reset ( )
inlineprivate

Definition at line 45 of file WireLink.h.

◆ setOwner()

bool yarp::os::WireLink::setOwner ( yarp::os::PortReader owner)
inline

Set the owner of this WireLink.

Data sent to this link will be passed on to the owner.

Parameters
ownerowner of this WireLink
Returns
true on success

Definition at line 75 of file WireLink.h.

◆ setStreamingMode()

bool yarp::os::WireLink::setStreamingMode ( bool  streaming)
inline

For a client WireLink, control whether replies to commands are expected.

Parameters
streamingtrue if replies are unnecessary.
Returns
true on success

Definition at line 134 of file WireLink.h.

◆ write() [1/2]

bool yarp::os::WireLink::write ( PortWriter writer)
inline

Write a message to the associated port or reader.

Parameters
writerthe message to send.
Returns
true on success

Definition at line 146 of file WireLink.h.

◆ write() [2/2]

bool yarp::os::WireLink::write ( PortWriter writer,
PortReader reader 
)
inline

Write a message to the associated port or reader, and read a reply.

Parameters
writerthe message to send.
readera recipient for the reply.
Returns
true on success

Definition at line 164 of file WireLink.h.

Member Data Documentation

◆ can_read

bool yarp::os::WireLink::can_read
private

Definition at line 35 of file WireLink.h.

◆ can_write

bool yarp::os::WireLink::can_write
private

Definition at line 34 of file WireLink.h.

◆ owner

yarp::os::PortReader* yarp::os::WireLink::owner
private

Definition at line 31 of file WireLink.h.

◆ port

yarp::os::UnbufferedContactable* yarp::os::WireLink::port
private

Definition at line 29 of file WireLink.h.

◆ reader

yarp::os::PortReader* yarp::os::WireLink::reader
private

Definition at line 30 of file WireLink.h.

◆ replies

bool yarp::os::WireLink::replies
private

Definition at line 33 of file WireLink.h.

◆ stack

yarp::os::MessageStack yarp::os::WireLink::stack
private

Definition at line 32 of file WireLink.h.


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