YARP
Yet Another Robot Platform
MpiP2PStream Class Reference

Implements communication via MPI point-to-point send/receive. More...

#include <mpi_carrier/MpiP2PStream.h>

+ Inheritance diagram for MpiP2PStream:

Public Member Functions

 MpiP2PStream (std::string name, MpiComm *comm)
 
ssize_t read (yarp::os::Bytes &b) override
 Read a block of data from the stream. More...
 
void write (const yarp::os::Bytes &b) override
 Write a block of bytes to the stream. More...
 
void close () override
 Terminate the stream. More...
 
void write (const yarp::os::Bytes &b) override=0
 
ssize_t read (yarp::os::Bytes &b) override=0
 Read and return a single byte. More...
 
- Public Member Functions inherited from MpiStream
 MpiStream (std::string name, MpiComm *comm)
 
virtual ~MpiStream ()
 
bool isOk () const override
 Check if the stream is ok or in an error state. More...
 
void interrupt () override
 Interrupt the stream. More...
 
InputStreamgetInputStream () override
 Get an InputStream to read from. More...
 
OutputStreamgetOutputStream () override
 Get an OutputStream to write to. More...
 
const yarp::os::ContactgetLocalAddress () const override
 Get the address of the local side of the stream. More...
 
const yarp::os::ContactgetRemoteAddress () const override
 Get the address of the remote side of the stream. More...
 
void resetBuffer ()
 
void reset () override
 Reset the stream. More...
 
void beginPacket () override
 Mark the beginning of a logical packet. More...
 
void endPacket () override
 Mark the end of a logical packet (see beginPacket). More...
 
- Public Member Functions inherited from yarp::os::TwoWayStream
virtual ~TwoWayStream ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::os::InputStream
 InputStream ()
 Constructor. More...
 
virtual ~InputStream ()
 Destructor. More...
 
virtual void check ()
 Perform maintenance actions, if needed. More...
 
virtual yarp::conf::ssize_t read (Bytes &b, size_t offset, yarp::conf::ssize_t len)
 Read a block of data from the stream. More...
 
virtual yarp::conf::ssize_t partialRead (yarp::os::Bytes &b)
 Like read, but solicit partial responses. More...
 
virtual bool setReadTimeout (double timeout)
 Set activity timeout. More...
 
std::string readLine (const char terminal='\n', bool *success=nullptr)
 Read a block of text terminated with a specific marker (or EOF). More...
 
yarp::conf::ssize_t readFull (Bytes &b)
 Keep reading until buffer is full. More...
 
yarp::conf::ssize_t readDiscard (size_t len)
 Read and discard a fixed number of bytes. More...
 
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. More...
 
- Public Member Functions inherited from yarp::os::OutputStream
virtual ~OutputStream ()
 Destructor. More...
 
virtual void write (char ch)
 Write a single byte to the stream. More...
 
virtual void write (const Bytes &b, int offset, int len)
 Write a block of bytes to the stream. More...
 
virtual void flush ()
 Make sure all pending write operations are finished. More...
 
virtual void writeLine (const char *data, int len)
 Write some text followed by a line feed. More...
 
virtual bool setWriteTimeout (double timeout)
 Set activity timeout. More...
 
virtual bool setTypeOfService (int tos)
 
virtual int getTypeOfService ()
 

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. More...
 
- Protected Attributes inherited from MpiStream
int readAvail
 
int readAt
 
char * readBuffer
 
bool terminate
 
std::string name
 
MpiCommcomm
 
yarp::os::Contact local
 
yarp::os::Contact remote
 

Detailed Description

Implements communication via MPI point-to-point send/receive.

Definition at line 18 of file MpiP2PStream.h.

Constructor & Destructor Documentation

◆ MpiP2PStream()

MpiP2PStream::MpiP2PStream ( std::string  name,
MpiComm comm 
)
inline

Definition at line 22 of file MpiP2PStream.h.

Member Function Documentation

◆ close()

void MpiP2PStream::close ( )
inlineoverridevirtual

Terminate the stream.

Implements MpiStream.

Definition at line 29 of file MpiP2PStream.h.

◆ read() [1/2]

ssize_t MpiP2PStream::read ( yarp::os::Bytes b)
overridevirtual

Read a block of data from the stream.

Should block and wait for data.

Parameters
b[out]the block of data to read to
Returns
the number of bytes read, or -1 upon error

Implements MpiStream.

Definition at line 18 of file MpiP2PStream.cpp.

◆ read() [2/2]

ssize_t MpiStream::read
overridevirtual

Read and return a single byte.

Should block and wait for data. By default, this calls read(Bytes& b) to do its work.

Returns
a byte from the stream (0-255), or -1 on failure.

Reimplemented from yarp::os::InputStream.

◆ write() [1/2]

void MpiP2PStream::write ( const yarp::os::Bytes b)
overridevirtual

Write a block of bytes to the stream.

Parameters
bthe bytes to write

Implements MpiStream.

Definition at line 72 of file MpiP2PStream.cpp.

◆ write() [2/2]

void MpiStream::write
override

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