YARP  2.3.70.2
Yet Another Robot Platform
yarp::os::ShiftStream Class Reference

A container for a stream, allowing the stream implementation to be replaced when needed. More...

#include <yarp/os/ShiftStream.h>

+ Inheritance diagram for yarp::os::ShiftStream:

Public Member Functions

 ShiftStream ()
 Constructor. More...
 
virtual ~ShiftStream ()
 Destructor. More...
 
virtual void check ()
 Perform maintenance actions, if needed. More...
 
virtual InputStreamgetInputStream () YARP_OVERRIDE
 Get an InputStream to read from. More...
 
virtual OutputStreamgetOutputStream () YARP_OVERRIDE
 Get an OutputStream to write to. More...
 
virtual const ContactgetLocalAddress () YARP_OVERRIDE
 Get the address of the local side of the stream. More...
 
virtual const ContactgetRemoteAddress () YARP_OVERRIDE
 Get the address of the remote side of the stream. More...
 
virtual void close () YARP_OVERRIDE
 Terminate the stream. More...
 
virtual void takeStream (TwoWayStream *stream)
 Wrap the supplied stream. More...
 
virtual TwoWayStreamgiveStream ()
 Removes the wrapped stream and returns it. More...
 
virtual TwoWayStreamgetStream ()
 
virtual bool isEmpty ()
 
virtual bool isOk () YARP_OVERRIDE
 Check if the stream is ok or in an error state. More...
 
virtual void reset () YARP_OVERRIDE
 Reset the stream. More...
 
virtual void beginPacket () YARP_OVERRIDE
 Mark the beginning of a logical packet. More...
 
virtual void endPacket () YARP_OVERRIDE
 Mark the end of a logical packet (see beginPacket). More...
 
- Public Member Functions inherited from yarp::os::TwoWayStream
virtual ~TwoWayStream ()
 Destructor. More...
 

Private Attributes

TwoWayStreamstream
 
NullStream nullStream
 

Detailed Description

A container for a stream, allowing the stream implementation to be replaced when needed.

This is important in YARP since connections "bootstrap" from an initial stream type to an optimized stream type with user-preferred properties and trade-offs.

Definition at line 25 of file ShiftStream.h.

Constructor & Destructor Documentation

◆ ShiftStream()

yarp::os::ShiftStream::ShiftStream ( )
inline

Constructor.

Definition at line 30 of file ShiftStream.h.

◆ ~ShiftStream()

virtual yarp::os::ShiftStream::~ShiftStream ( )
inlinevirtual

Destructor.

Definition at line 37 of file ShiftStream.h.

Member Function Documentation

◆ beginPacket()

virtual void yarp::os::ShiftStream::beginPacket ( )
inlinevirtual

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 133 of file ShiftStream.h.

◆ check()

virtual void yarp::os::ShiftStream::check ( )
inlinevirtual

Perform maintenance actions, if needed.

Definition at line 44 of file ShiftStream.h.

◆ close()

virtual void yarp::os::ShiftStream::close ( )
inlinevirtual

Terminate the stream.

Implements yarp::os::TwoWayStream.

Definition at line 75 of file ShiftStream.h.

◆ endPacket()

virtual void yarp::os::ShiftStream::endPacket ( )
inlinevirtual

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

Implements yarp::os::TwoWayStream.

Definition at line 139 of file ShiftStream.h.

◆ getInputStream()

virtual InputStream& yarp::os::ShiftStream::getInputStream ( )
inlinevirtual

Get an InputStream to read from.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 47 of file ShiftStream.h.

◆ getLocalAddress()

virtual const Contact& yarp::os::ShiftStream::getLocalAddress ( )
inlinevirtual

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 63 of file ShiftStream.h.

◆ getOutputStream()

virtual OutputStream& yarp::os::ShiftStream::getOutputStream ( )
inlinevirtual

Get an OutputStream to write to.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 55 of file ShiftStream.h.

◆ getRemoteAddress()

virtual const Contact& yarp::os::ShiftStream::getRemoteAddress ( )
inlinevirtual

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 69 of file ShiftStream.h.

◆ getStream()

virtual TwoWayStream* yarp::os::ShiftStream::getStream ( )
inlinevirtual
Returns
the wrapped stream (which after this call will remain this container's responsibility - compare with giveStream).

Definition at line 109 of file ShiftStream.h.

◆ giveStream()

virtual TwoWayStream* yarp::os::ShiftStream::giveStream ( )
inlinevirtual

Removes the wrapped stream and returns it.

The caller will be responsible for closing the stream.

Returns
the wrapped stream (which after this call will be the caller's responsibility).

Definition at line 99 of file ShiftStream.h.

◆ isEmpty()

virtual bool yarp::os::ShiftStream::isEmpty ( )
inlinevirtual
Returns
true if there is no wrapped stream.

Definition at line 116 of file ShiftStream.h.

◆ isOk()

virtual bool yarp::os::ShiftStream::isOk ( )
inlinevirtual

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

Returns
true iff the stream is ok

Implements yarp::os::TwoWayStream.

Definition at line 120 of file ShiftStream.h.

◆ reset()

virtual void yarp::os::ShiftStream::reset ( )
inlinevirtual

Reset the stream.

Implements yarp::os::TwoWayStream.

Definition at line 127 of file ShiftStream.h.

◆ takeStream()

virtual void yarp::os::ShiftStream::takeStream ( TwoWayStream stream)
inlinevirtual

Wrap the supplied stream.

If a stream is already wrapped, it will be closed and destroyed.

Parameters
streamthe stream to wrap.

Definition at line 88 of file ShiftStream.h.

Member Data Documentation

◆ nullStream

NullStream yarp::os::ShiftStream::nullStream
private

Definition at line 147 of file ShiftStream.h.

◆ stream

TwoWayStream* yarp::os::ShiftStream::stream
private

Definition at line 146 of file ShiftStream.h.


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