|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
62 WireLink::WireLink() :
74 return mPriv->port !=
nullptr || mPriv->reader !=
nullptr;
79 mPriv->owner = &owner;
86 mPriv->attach(port, style);
87 mPriv->can_write =
true;
88 mPriv->can_read =
false;
95 mPriv->reader = &reader;
96 mPriv->can_write =
true;
97 mPriv->can_read =
false;
104 mPriv->attach(port, style);
106 mPriv->can_write =
false;
107 mPriv->can_read =
true;
113 mPriv->replies = !streaming;
119 if (mPriv->reader !=
nullptr) {
122 return mPriv->reader->read(con.
getReader());
127 return mPriv->port->write(writer);
132 if (mPriv->reader !=
nullptr) {
135 bool ok = mPriv->reader->read(con.
getReader());
142 if (!mPriv->replies) {
143 mPriv->port->write(writer);
146 return mPriv->port->write(writer, reader);
151 mPriv->stack.attach(reader);
152 mPriv->stack.stack(writer, tag);
158 return mPriv->can_write;
163 return mPriv->can_read;
A dummy connection to test yarp::os::Portable implementations.
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
bool setOwner(yarp::os::PortReader &owner)
Set the owner of this WireLink.
bool write(PortWriter &writer)
Write a message to the associated port or reader.
bool attach(yarp::os::UnbufferedContactable &port, const yarp::os::ContactStyle &style)
yarp::os::PortReader * reader
bool attachAsServer(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a server, receiving commands via the specified port.
ConnectionReader & getReader(ConnectionWriter *replyWriter=nullptr)
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
IDL-friendly object state, used in YARP to set up a port association.
yarp::os::UnbufferedContactable * port
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
yarp::os::PortReader * owner
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
yarp::os::MessageStack stack
bool isValid() const
Check if there is an association of some kind set up for this WireLink.
bool callback(PortWriter &writer, PortReader &reader, const std::string &tag="")
Put a message in a stack to call later, asynchronously.
bool attachAsClient(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a client, sending data via the specified port.
bool setStreamingMode(bool streaming)
For a client WireLink, control whether replies to commands are expected.
Maintain a stack of messages to send asynchronously.