SurgSim::Testing::MockInputOutput Struct Reference

`#include <SurgSim/Testing/MockInputOutput.h>`

Inheritance diagram for SurgSim::Testing::MockInputOutput:

## Public Member Functions

| MockInputOutput ()
virtual void | initializeInput (const std::string &device, const SurgSim::DataStructures::DataGroup &inputData)
| Set the initial input data group. More...
virtual void | handleInput (const std::string &device, const SurgSim::DataStructures::DataGroup &inputData)
| Notifies the consumer that the application input coming from the device has been updated. More...
virtual bool | requestOutput (const std::string &device, SurgSim::DataStructures::DataGroup *outputData)
| Asks the producer to provide output state to the device. More...
Public Member Functions inherited from SurgSim::Input::InputConsumerInterface
virtual | ~InputConsumerInterface ()
| Virtual destructor (empty). More...
Public Member Functions inherited from SurgSim::Input::OutputProducerInterface
virtual | ~OutputProducerInterface ()
| Virtual destructor (empty). More...

## Public Attributes

int | m_numTimesInitializedInput
int | m_numTimesReceivedInput
int | m_numTimesRequestedOutput
SurgSim::DataStructures::DataGroup | m_lastReceivedInput
SurgSim::DataStructures::OptionalValue< SurgSim::DataStructures::DataGroup > | m_output

## Constructor & Destructor Documentation

## MockInputOutput()

SurgSim::Testing::MockInputOutput::MockInputOutput | ( |  | ) |

## Member Function Documentation

## handleInput()

void SurgSim::Testing::MockInputOutput::handleInput | ( | const std::string & | device,
|  | const SurgSim::DataStructures::DataGroup & | inputData
| ) |  |

virtual

Notifies the consumer that the application input coming from the device has been updated.

Typical input data contents (but note that individual devices may do things differently):

type | name |
--- | --- | ---
pose | "pose" | Device pose (units are meters).
bool | "button1" | State of the first device button.
bool | "button2" | State of the second device button (and so on).

Other possible contents includes:

type | name |
--- | --- | ---
bool | "isHomed" | Device homing status.
bool | "isHomedX" | Individual homing status for the X axis (and so on).
bool | "isHeld" | Safety sensor etc. status.
string | "model" | Device model description.
string | "serial" | Serial number string.
(any) | "debug:*" | Various debugging information

Parameters

  device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once).
  inputData | The application input state coming from the device.

Implements SurgSim::Input::InputConsumerInterface.

## initializeInput()

void SurgSim::Testing::MockInputOutput::initializeInput | ( | const std::string & | device,
|  | const SurgSim::DataStructures::DataGroup & | inputData
| ) |  |

virtual

Set the initial input data group.

Parameters

  device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once).
  inputData | The application input state coming from the device.

Implements SurgSim::Input::InputConsumerInterface.

## requestOutput()

bool SurgSim::Testing::MockInputOutput::requestOutput | ( | const std::string & | device,
|  | SurgSim::DataStructures::DataGroup * | outputData
| ) |  |

virtual

Asks the producer to provide output state to the device.

Note that devices may never call this method, e.g. because the device doesn't actually have any output capability.

Typical output data contents (but note that individual devices may do things differently):

type | name |
--- | --- | ---
vector | "force" | Commanded force for the device (units are newtons).
vector | "torque" | Commanded torque for the device (units are newton-meters).
bool | "isEnabled" | Safety switch input.

Other possible contents includes:

type | name |
--- | --- | ---
bool | "led0" | Desired state for LED 0.
bool | "led1" | Desired state for LED 1.
string | "toolId" | Calibration ID to use, e.g. for camera devices.

Parameters

  | device | The name of the device that is requesting the output. This should only be used to identify the device (e.g. if the producer is listening to several devices at once).
  [out] | outputData | The application output state being fed into the device.

Returns
  true if the producer has provided some output, false if it refuses to do so. A producer that returns false should leave outputData unmodified.

Implements SurgSim::Input::OutputProducerInterface.

## Member Data Documentation

## m_lastReceivedInput

SurgSim::DataStructures::DataGroup SurgSim::Testing::MockInputOutput::m_lastReceivedInput

## m_numTimesInitializedInput

int SurgSim::Testing::MockInputOutput::m_numTimesInitializedInput

## m_numTimesReceivedInput

int SurgSim::Testing::MockInputOutput::m_numTimesReceivedInput

## m_numTimesRequestedOutput

int SurgSim::Testing::MockInputOutput::m_numTimesRequestedOutput

## m_output

SurgSim::DataStructures::OptionalValue<SurgSim::DataStructures::DataGroup> SurgSim::Testing::MockInputOutput::m_output

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

- SurgSim/Testing/MockInputOutput.h
- SurgSim/Testing/MockInputOutput.cpp