YARP
Yet Another Robot Platform
yarp::os::impl::DgramTwoWayStream Class Reference

A stream abstraction for datagram communication. More...

#include <yarp/os/impl/DgramTwoWayStream.h>

+ Inheritance diagram for yarp::os::impl::DgramTwoWayStream:

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 ()
 
InputStreamgetInputStream () override
 Get an InputStream to read from. More...
 
OutputStreamgetOutputStream () override
 Get an OutputStream to write to. More...
 
const ContactgetLocalAddress () const override
 Get the address of the local side of the stream. More...
 
const ContactgetRemoteAddress () const override
 Get the address of the remote side of the stream. More...
 
void interrupt () override
 Interrupt the stream. More...
 
void close () override
 Terminate the stream. More...
 
virtual void closeMain ()
 
yarp::conf::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 flush () override
 Make sure all pending write operations are finished. More...
 
bool isOk () const override
 Check if the stream is ok or in an error state. More...
 
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...
 
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. 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 int read ()
 Read and return a single byte. 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 writeLine (const char *data, int len)
 Write some text followed by a line feed. More...
 
virtual bool setWriteTimeout (double timeout)
 Set activity timeout. More...
 

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...
 

Detailed Description

A stream abstraction for datagram communication.

It supports UDP and MCAST. This class is not concerned with making the stream reliable.

Definition at line 36 of file DgramTwoWayStream.h.

Constructor & Destructor Documentation

◆ DgramTwoWayStream()

yarp::os::impl::DgramTwoWayStream::DgramTwoWayStream ( )
inline

Definition at line 43 of file DgramTwoWayStream.h.

◆ ~DgramTwoWayStream()

DgramTwoWayStream::~DgramTwoWayStream ( )
virtual

Definition at line 600 of file DgramTwoWayStream.cpp.

Member Function Documentation

◆ beginPacket()

void DgramTwoWayStream::beginPacket ( )
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 941 of file DgramTwoWayStream.cpp.

◆ close()

void yarp::os::impl::DgramTwoWayStream::close ( )
inlineoverridevirtual

Terminate the stream.

Implements yarp::os::InputStream.

Definition at line 117 of file DgramTwoWayStream.h.

◆ closeMain()

void DgramTwoWayStream::closeMain ( )
virtual

Definition at line 665 of file DgramTwoWayStream.cpp.

◆ endPacket()

void DgramTwoWayStream::endPacket ( )
overridevirtual

Mark the end of a logical packet (see beginPacket).

Implements yarp::os::TwoWayStream.

Definition at line 947 of file DgramTwoWayStream.cpp.

◆ flush()

void DgramTwoWayStream::flush ( )
overridevirtual

Make sure all pending write operations are finished.

Reimplemented from yarp::os::OutputStream.

Definition at line 847 of file DgramTwoWayStream.cpp.

◆ getInputStream()

InputStream& yarp::os::impl::DgramTwoWayStream::getInputStream ( )
inlineoverridevirtual

Get an InputStream to read from.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Reimplemented in H264Stream.

Definition at line 95 of file DgramTwoWayStream.h.

◆ getLocalAddress()

const Contact& yarp::os::impl::DgramTwoWayStream::getLocalAddress ( ) const
inlineoverridevirtual

Get the address of the local side of the stream.

Returns
the address of the local side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 105 of file DgramTwoWayStream.h.

◆ getMonitor()

Bytes DgramTwoWayStream::getMonitor ( )

Definition at line 955 of file DgramTwoWayStream.cpp.

◆ getOutputStream()

OutputStream& yarp::os::impl::DgramTwoWayStream::getOutputStream ( )
inlineoverridevirtual

Get an OutputStream to write to.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Reimplemented in H264Stream.

Definition at line 100 of file DgramTwoWayStream.h.

◆ getRemoteAddress()

const Contact& yarp::os::impl::DgramTwoWayStream::getRemoteAddress ( ) const
inlineoverridevirtual

Get the address of the remote side of the stream.

Returns
the address of the remote side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 110 of file DgramTwoWayStream.h.

◆ getTypeOfService()

int DgramTwoWayStream::getTypeOfService ( )
overridevirtual

Reimplemented from yarp::os::OutputStream.

Definition at line 979 of file DgramTwoWayStream.cpp.

◆ interrupt()

void DgramTwoWayStream::interrupt ( )
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 605 of file DgramTwoWayStream.cpp.

◆ isOk()

bool DgramTwoWayStream::isOk ( ) const
overridevirtual

Check if the stream is ok or in an error state.

Returns
true iff the stream is ok

Implements yarp::os::InputStream.

Definition at line 926 of file DgramTwoWayStream.cpp.

◆ join() [1/2]

virtual bool yarp::os::impl::DgramTwoWayStream::join ( const Contact group,
bool  sender 
)
inlinevirtual

Definition at line 88 of file DgramTwoWayStream.h.

◆ join() [2/2]

bool DgramTwoWayStream::join ( const Contact group,
bool  sender,
const Contact ipLocal 
)
virtual

Definition at line 486 of file DgramTwoWayStream.cpp.

◆ onMonitorInput()

virtual void yarp::os::impl::DgramTwoWayStream::onMonitorInput ( )
inlinevirtual

Definition at line 154 of file DgramTwoWayStream.h.

◆ onMonitorOutput()

virtual void yarp::os::impl::DgramTwoWayStream::onMonitorOutput ( )
inlinevirtual

Definition at line 158 of file DgramTwoWayStream.h.

◆ open() [1/2]

bool DgramTwoWayStream::open ( const Contact local,
const Contact remote 
)
virtual

Definition at line 104 of file DgramTwoWayStream.cpp.

◆ open() [2/2]

bool DgramTwoWayStream::open ( const Contact remote)
virtual

Definition at line 92 of file DgramTwoWayStream.cpp.

◆ openMcast()

bool DgramTwoWayStream::openMcast ( const Contact group,
const Contact ipLocal 
)
virtual

Definition at line 391 of file DgramTwoWayStream.cpp.

◆ openMonitor()

virtual bool yarp::os::impl::DgramTwoWayStream::openMonitor ( int  readSize = 0,
int  writeSize = 0 
)
inlinevirtual

Definition at line 66 of file DgramTwoWayStream.h.

◆ read()

yarp::conf::ssize_t DgramTwoWayStream::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 yarp::os::InputStream.

Reimplemented in H264Stream.

Definition at line 699 of file DgramTwoWayStream.cpp.

◆ removeMonitor()

void DgramTwoWayStream::removeMonitor ( )

Definition at line 961 of file DgramTwoWayStream.cpp.

◆ reset()

void DgramTwoWayStream::reset ( )
overridevirtual

Reset the stream.

Implements yarp::os::TwoWayStream.

Definition at line 932 of file DgramTwoWayStream.cpp.

◆ setMonitor()

void yarp::os::impl::DgramTwoWayStream::setMonitor ( const yarp::os::Bytes data)
inline

Definition at line 146 of file DgramTwoWayStream.h.

◆ setTypeOfService()

bool DgramTwoWayStream::setTypeOfService ( int  tos)
overridevirtual

Reimplemented from yarp::os::OutputStream.

Definition at line 967 of file DgramTwoWayStream.cpp.

◆ write()

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

Write a block of bytes to the stream.

Parameters
bthe bytes to write

Implements yarp::os::OutputStream.

Reimplemented in H264Stream.

Definition at line 815 of file DgramTwoWayStream.cpp.


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