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;
yarp::os::MessageStack stack
yarp::os::UnbufferedContactable * port
yarp::os::PortReader * reader
bool attach(yarp::os::UnbufferedContactable &port, const yarp::os::ContactStyle &style)
yarp::os::PortReader * owner
A dummy connection to test yarp::os::Portable implementations.
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
ConnectionReader & getReader()
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
Maintain a stack of messages to send asynchronously.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
IDL-friendly object state, used in YARP to set up a port association.
bool write(PortWriter &writer)
Write a message to the associated port or reader.
bool callback(PortWriter &writer, PortReader &reader, const std::string &tag="")
Put a message in a stack to call later, asynchronously.
bool attachAsServer(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a server, receiving commands via the specified port.
bool setOwner(yarp::os::PortReader &owner)
Set the owner of this WireLink.
bool attachAsClient(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a client, sending data via the specified port.
bool isValid() const
Check if there is an association of some kind set up for this WireLink.
bool setStreamingMode(bool streaming)
For a client WireLink, control whether replies to commands are expected.