Abstract base class for port communication via MPI. More...
#include <mpi_carrier/MpiStream.h>
Public Member Functions | |
MpiStream (std::string name, MpiComm *comm) | |
virtual | ~MpiStream () |
void | close () override=0 |
Terminate the stream. | |
bool | isOk () const override |
Check if the stream is ok or in an error state. | |
void | interrupt () override |
Interrupt the stream. | |
ssize_t | read (yarp::os::Bytes &b) override=0 |
Read a block of data from the stream. | |
void | write (const yarp::os::Bytes &b) override=0 |
Write a block of bytes to the stream. | |
InputStream & | getInputStream () override |
Get an InputStream to read from. | |
OutputStream & | getOutputStream () override |
Get an OutputStream to write to. | |
const yarp::os::Contact & | getLocalAddress () const override |
Get the address of the local side of the stream. | |
const yarp::os::Contact & | getRemoteAddress () const override |
Get the address of the remote side of the stream. | |
void | resetBuffer () |
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). | |
![]() | |
virtual | ~TwoWayStream () |
Destructor. | |
![]() | |
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. | |
![]() | |
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 | flush () |
Make sure all pending write operations are finished. | |
virtual void | writeLine (const char *data, int len) |
Write some text followed by a line feed. | |
virtual bool | setWriteTimeout (double timeout) |
Set activity timeout. | |
virtual bool | setTypeOfService (int tos) |
virtual int | getTypeOfService () |
Protected Attributes | |
int | readAvail |
int | readAt |
char * | readBuffer |
bool | terminate |
std::string | name |
MpiComm * | comm |
yarp::os::Contact | local |
yarp::os::Contact | remote |
Additional Inherited Members | |
![]() | |
typedef void(* | readEnvelopeCallbackType) (void *, const yarp::os::Bytes &envelope) |
Callback type for setting the envelope from a message in carriers that cannot be escaped. | |
Abstract base class for port communication via MPI.
Definition at line 25 of file MpiStream.h.
MpiStream::MpiStream | ( | std::string | name, |
MpiComm * | comm | ||
) |
Definition at line 19 of file MpiStream.cpp.
|
virtual |
Definition at line 26 of file MpiStream.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 64 of file MpiStream.cpp.
|
overridepure virtual |
Terminate the stream.
Implements yarp::os::TwoWayStream.
Implemented in MpiBcastStream, and MpiP2PStream.
|
overridevirtual |
Mark the end of a logical packet (see beginPacket).
Implements yarp::os::TwoWayStream.
Definition at line 67 of file MpiStream.cpp.
|
overridevirtual |
Get an InputStream to read from.
Implements yarp::os::TwoWayStream.
Definition at line 50 of file MpiStream.cpp.
|
overridevirtual |
Get the address of the local side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 56 of file MpiStream.cpp.
|
overridevirtual |
Get an OutputStream to write to.
Implements yarp::os::TwoWayStream.
Definition at line 53 of file MpiStream.cpp.
|
overridevirtual |
Get the address of the remote side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 60 of file MpiStream.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 42 of file MpiStream.cpp.
|
overridevirtual |
Check if the stream is ok or in an error state.
Implements yarp::os::TwoWayStream.
Definition at line 38 of file MpiStream.cpp.
|
overridepure virtual |
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.
Implemented in MpiBcastStream, MpiP2PStream, MpiBcastStream, and MpiP2PStream.
|
inlineoverridevirtual |
void MpiStream::resetBuffer | ( | ) |
Definition at line 30 of file MpiStream.cpp.
|
overridepure virtual |
Write a block of bytes to the stream.
b | the bytes to write |
Implements yarp::os::OutputStream.
Implemented in MpiBcastStream, MpiP2PStream, MpiBcastStream, and MpiP2PStream.
|
protected |
Definition at line 35 of file MpiStream.h.
|
protected |
Definition at line 37 of file MpiStream.h.
|
protected |
Definition at line 34 of file MpiStream.h.
|
protected |
Definition at line 31 of file MpiStream.h.
|
protected |
Definition at line 31 of file MpiStream.h.
|
protected |
Definition at line 32 of file MpiStream.h.
|
protected |
Definition at line 38 of file MpiStream.h.
|
protected |
Definition at line 33 of file MpiStream.h.