YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::DummyConnector Class Reference

A dummy connection to test yarp::os::Portable implementations. More...

#include <yarp/os/DummyConnector.h>

Public Member Functions

 DummyConnector ()
 Default constructor.
 
virtual ~DummyConnector ()
 Destructor.
 
void setTextMode (bool textmode)
 Set the textMode of the dummy connection.
 
ConnectionWritergetCleanWriter ()
 Get a clean/empty dummy ConnectionWriter.
 
ConnectionWritergetWriter ()
 Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was last reset.
 
ConnectionReadergetReader (ConnectionWriter *replyWriter=nullptr)
 Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was last reset.
 
void reset ()
 Reset and clear the current ConnectionWriter.
 

Detailed Description

A dummy connection to test yarp::os::Portable implementations.

This class provides simple means to test read and write methods of the Portable interface.

Pseudocode for a test should look something like this:

DummyConnector dummy; // create new connection with textmode=false
... // set object values
object.write(dummy.getWriter()); // reset the connection and then write to it
newObject.read(dummy.getReader()); // write from the connection to the new object
... // assert newObject values
A mini-server for performing network communication in the background.
T * read(bool shouldWait=true) override
Read an available object from the port.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
A dummy connection to test yarp::os::Portable implementations.
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
ConnectionReader & getReader(ConnectionWriter *replyWriter=nullptr)
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...

Definition at line 30 of file DummyConnector.h.

Constructor & Destructor Documentation

◆ DummyConnector()

DummyConnector::DummyConnector ( )

Default constructor.

TextMode set to false.

Definition at line 89 of file DummyConnector.cpp.

◆ ~DummyConnector()

DummyConnector::~DummyConnector ( )
virtual

Destructor.

Definition at line 94 of file DummyConnector.cpp.

Member Function Documentation

◆ getCleanWriter()

ConnectionWriter & DummyConnector::getCleanWriter ( )

Get a clean/empty dummy ConnectionWriter.

This will reset the connection each time.

Returns
a empty dummy ConnectionWriter
See also
ConnectionWriter Portable

Definition at line 104 of file DummyConnector.cpp.

◆ getReader()

ConnectionReader & DummyConnector::getReader ( ConnectionWriter replyWriter = nullptr)

Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was last reset.

Parameters
replyWriterA writer to be used for replies received on the connection.
Returns
a loaded ConnectionReader if it was previously written to
See also
ConnectionReader Portable
Warning
Calling this method twice will reset the reader

Definition at line 114 of file DummyConnector.cpp.

◆ getWriter()

ConnectionWriter & DummyConnector::getWriter ( )

Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was last reset.

Returns
the current ConnectionWriter
See also
ConnectionWriter Portable

Definition at line 109 of file DummyConnector.cpp.

◆ reset()

void DummyConnector::reset ( )

Reset and clear the current ConnectionWriter.

Definition at line 119 of file DummyConnector.cpp.

◆ setTextMode()

void DummyConnector::setTextMode ( bool  textmode)

Set the textMode of the dummy connection.

Parameters
textmodenew textmode value

Definition at line 99 of file DummyConnector.cpp.


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