A stream abstraction for datagram communication. More...
#include <yarp/os/impl/DgramTwoWayStream.h>
Public Member Functions | |
DgramTwoWayStream () | |
virtual bool | openMonitor (int readSize=0, int writeSize=0) |
virtual bool | open (const Contact &remote) |
virtual bool | open (const Contact &local, const Contact &remote) |
virtual bool | openMcast (const Contact &group, const Contact &ipLocal) |
virtual bool | join (const Contact &group, bool sender, const Contact &ipLocal) |
virtual bool | join (const Contact &group, bool sender) |
virtual | ~DgramTwoWayStream () |
InputStream & | getInputStream () override |
Get an InputStream to read from. | |
OutputStream & | getOutputStream () override |
Get an OutputStream to write to. | |
const Contact & | getLocalAddress () const override |
Get the address of the local side of the stream. | |
const Contact & | getRemoteAddress () const override |
Get the address of the remote side of the stream. | |
void | interrupt () override |
Interrupt the stream. | |
void | close () override |
Terminate the stream. | |
virtual void | closeMain () |
yarp::conf::ssize_t | read (yarp::os::Bytes &b) override |
Read a block of data from the stream. | |
void | write (const yarp::os::Bytes &b) override |
Write a block of bytes to the stream. | |
void | flush () override |
Make sure all pending write operations are finished. | |
bool | isOk () const override |
Check if the stream is ok or in an error state. | |
void | reset () override |
Reset the stream. | |
void | beginPacket () override |
Mark the beginning of a logical packet. | |
void | endPacket () override |
Mark the end of a logical packet (see beginPacket). | |
yarp::os::Bytes | getMonitor () |
bool | setTypeOfService (int tos) override |
int | getTypeOfService () override |
void | setMonitor (const yarp::os::Bytes &data) |
void | removeMonitor () |
virtual void | onMonitorInput () |
virtual void | onMonitorOutput () |
Public Member Functions inherited from yarp::os::TwoWayStream | |
virtual | ~TwoWayStream () |
Destructor. | |
Public Member Functions inherited from yarp::os::InputStream | |
InputStream () | |
Constructor. | |
virtual | ~InputStream () |
Destructor. | |
virtual void | check () |
Perform maintenance actions, if needed. | |
virtual int | read () |
Read and return a single byte. | |
virtual yarp::conf::ssize_t | read (Bytes &b, size_t offset, yarp::conf::ssize_t len) |
Read a block of data from the stream. | |
virtual yarp::conf::ssize_t | partialRead (yarp::os::Bytes &b) |
Like read, but solicit partial responses. | |
virtual bool | setReadTimeout (double timeout) |
Set activity timeout. | |
std::string | readLine (const char terminal='\n', bool *success=nullptr) |
Read a block of text terminated with a specific marker (or EOF). | |
yarp::conf::ssize_t | readFull (Bytes &b) |
Keep reading until buffer is full. | |
yarp::conf::ssize_t | readDiscard (size_t len) |
Read and discard a fixed number of bytes. | |
virtual bool | setReadEnvelopeCallback (readEnvelopeCallbackType callback, void *data) |
Install a callback that the InputStream will have to call when the envelope is read from a message in carriers that cannot be escaped. | |
Public Member Functions inherited from yarp::os::OutputStream | |
virtual | ~OutputStream () |
Destructor. | |
virtual void | write (char ch) |
Write a single byte to the stream. | |
virtual void | write (const Bytes &b, int offset, int len) |
Write a block of bytes to the stream. | |
virtual void | writeLine (const char *data, int len) |
Write some text followed by a line feed. | |
virtual bool | setWriteTimeout (double timeout) |
Set activity timeout. | |
Additional Inherited Members | |
Public Types inherited from yarp::os::InputStream | |
typedef void(* | readEnvelopeCallbackType) (void *, const yarp::os::Bytes &envelope) |
Callback type for setting the envelope from a message in carriers that cannot be escaped. | |
A stream abstraction for datagram communication.
It supports UDP and MCAST. This class is not concerned with making the stream reliable.
Definition at line 31 of file DgramTwoWayStream.h.
|
inline |
Definition at line 38 of file DgramTwoWayStream.h.
|
virtual |
Definition at line 597 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Mark the beginning of a logical packet.
This is a unit that should be treated in an atomic fashion by YARP. If any part is corrupted, the whole should be dropped.
Implements yarp::os::TwoWayStream.
Definition at line 938 of file DgramTwoWayStream.cpp.
|
inlineoverridevirtual |
Terminate the stream.
Implements yarp::os::TwoWayStream.
Definition at line 112 of file DgramTwoWayStream.h.
|
virtual |
Definition at line 662 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Mark the end of a logical packet (see beginPacket).
Implements yarp::os::TwoWayStream.
Definition at line 944 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Make sure all pending write operations are finished.
Reimplemented from yarp::os::OutputStream.
Definition at line 844 of file DgramTwoWayStream.cpp.
|
inlineoverridevirtual |
Get an InputStream to read from.
Implements yarp::os::TwoWayStream.
Definition at line 90 of file DgramTwoWayStream.h.
Get the address of the local side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 100 of file DgramTwoWayStream.h.
Bytes DgramTwoWayStream::getMonitor | ( | ) |
Definition at line 952 of file DgramTwoWayStream.cpp.
|
inlineoverridevirtual |
Get an OutputStream to write to.
Implements yarp::os::TwoWayStream.
Definition at line 95 of file DgramTwoWayStream.h.
Get the address of the remote side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 105 of file DgramTwoWayStream.h.
|
overridevirtual |
Reimplemented from yarp::os::OutputStream.
Definition at line 976 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Interrupt the stream.
If the stream is currently in a blocked state, it must be unblocked.
Reimplemented from yarp::os::InputStream.
Definition at line 602 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Check if the stream is ok or in an error state.
Implements yarp::os::TwoWayStream.
Definition at line 923 of file DgramTwoWayStream.cpp.
|
inlinevirtual |
Definition at line 83 of file DgramTwoWayStream.h.
|
virtual |
Definition at line 483 of file DgramTwoWayStream.cpp.
Definition at line 149 of file DgramTwoWayStream.h.
Definition at line 153 of file DgramTwoWayStream.h.
Definition at line 101 of file DgramTwoWayStream.cpp.
Definition at line 89 of file DgramTwoWayStream.cpp.
Definition at line 388 of file DgramTwoWayStream.cpp.
|
inlinevirtual |
Definition at line 61 of file DgramTwoWayStream.h.
|
overridevirtual |
Read a block of data from the stream.
Should block and wait for data.
b[out] | the block of data to read to |
Implements yarp::os::InputStream.
Definition at line 696 of file DgramTwoWayStream.cpp.
void DgramTwoWayStream::removeMonitor | ( | ) |
Definition at line 958 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Reset the stream.
Implements yarp::os::TwoWayStream.
Definition at line 929 of file DgramTwoWayStream.cpp.
|
inline |
Definition at line 141 of file DgramTwoWayStream.h.
Reimplemented from yarp::os::OutputStream.
Definition at line 964 of file DgramTwoWayStream.cpp.
|
overridevirtual |
Write a block of bytes to the stream.
b | the bytes to write |
Implements yarp::os::OutputStream.
Definition at line 812 of file DgramTwoWayStream.cpp.