YARP
Yet Another Robot Platform
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. More...
 
virtual ~DummyConnector ()
 Destructor. More...
 
void setTextMode (bool textmode)
 Set the textMode of the dummy connection. More...
 
ConnectionWritergetCleanWriter ()
 Get a clean/empty dummy ConnectionWriter. More...
 
ConnectionWritergetWriter ()
 Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was last reset. More...
 
ConnectionReadergetReader (ConnectionWriter *replyWriter=nullptr)
 Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was last reset. More...
 
void reset ()
 Reset and clear the current ConnectionWriter. More...
 

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
PortableObject object;
... // set object values
object.write(dummy.getWriter()); // reset the connection and then write to it
PortableObject newObject;
newObject.read(dummy.getReader()); // write from the connection to the new object
... // assert newObject values

Definition at line 34 of file DummyConnector.h.

Constructor & Destructor Documentation

◆ DummyConnector()

DummyConnector::DummyConnector ( )

Default constructor.

TextMode set to false.

Definition at line 92 of file DummyConnector.cpp.

◆ ~DummyConnector()

DummyConnector::~DummyConnector ( )
virtual

Destructor.

Definition at line 97 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 107 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 117 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 112 of file DummyConnector.cpp.

◆ reset()

void DummyConnector::reset ( )

Reset and clear the current ConnectionWriter.

Definition at line 122 of file DummyConnector.cpp.

◆ setTextMode()

void DummyConnector::setTextMode ( bool  textmode)

Set the textMode of the dummy connection.

Parameters
textmodenew textmode value

Definition at line 102 of file DummyConnector.cpp.


The documentation for this class was generated from the following files:
yarp::os::DummyConnector::DummyConnector
DummyConnector()
Default constructor.
Definition: DummyConnector.cpp:92