SurgSim::Devices::RawMultiAxisScaffold Class Reference

A class that implements the behavior of RawMultiAxisDevice objects. More...

`#include <SurgSim/Devices/MultiAxis/RawMultiAxisScaffold.h>`

## Classes

struct | DeviceData
struct | StateData

## Public Member Functions

| RawMultiAxisScaffold ()
| Constructor. More...
| ~RawMultiAxisScaffold ()
| Destructor. More...

## Static Public Member Functions

static std::shared_ptr< RawMultiAxisScaffold > | getOrCreateSharedInstance ()
| Gets or creates the scaffold shared by all RawMultiAxisDevice instances. More...

## Private Member Functions

bool | registerDevice (RawMultiAxisDevice *device)
| Registers the specified device object. More...
bool | unregisterDevice (const RawMultiAxisDevice *device)
| Unregisters the specified device object. More...
void | setPositionScale (const RawMultiAxisDevice *device, double scale)
| Sets the position scale for this device. More...
void | setOrientationScale (const RawMultiAxisDevice *device, double scale)
| Sets the orientation scale for this device. More...
void | setAxisDominance (const RawMultiAxisDevice *device, bool onOff)
| Turns on or off the axis dominance setting for this device. More...
bool | runInputFrame (DeviceData *info)
| Executes the operations for a single input frame for a single device. More...
bool | runAfterLastFrame (DeviceData *info)
| Executes the operations after the last input frame, as the device input loop thread is shutting down. More...
bool | updateDevice (DeviceData *info)
| Updates the device information for a single device. More...
bool | findUnusedDeviceAndRegister (RawMultiAxisDevice *device, int *numUsedDevicesSeen)
| Scans hardware that is present in the system, and if an unused device is found, register an object for it. More...
bool | registerIfUnused (const std::string &path, RawMultiAxisDevice *device, int *numUsedDevicesSeen)
| Register a device object given a device path, if the same path is not already in use. More...
bool | createPerDeviceThread (DeviceData *data)
| Creates the input loop thread. More...
bool | destroyPerDeviceThread (DeviceData *data)
| Destroys the input loop thread. More...
std::unique_ptr< SystemInputDeviceHandle > | openDevice (const std::string &path)
| Opens the specified device. More...

## Static Private Member Functions

static SurgSim::DataStructures::DataGroup | buildDeviceInputData ()
| Builds the data layout for the application input (i.e. device output). More...

## Private Attributes

std::shared_ptr< SurgSim::Framework::Logger > | m_logger
| Logger used by the scaffold and all devices. More...
std::unique_ptr< StateData > | m_state
| Internal scaffold state. More...

## Friends

class | RawMultiAxisDevice
class | RawMultiAxisThread
struct | StateData

## Detailed Description

A class that implements the behavior of RawMultiAxisDevice objects.

See also
  SurgSim::Devices::RawMultiAxisDevice

## Constructor & Destructor Documentation

## RawMultiAxisScaffold()

SurgSim::Devices::RawMultiAxisScaffold::RawMultiAxisScaffold | ( |  | ) |

Constructor.

## ~RawMultiAxisScaffold()

SurgSim::Devices::RawMultiAxisScaffold::~RawMultiAxisScaffold | ( |  | ) |

Destructor.

## Member Function Documentation

## buildDeviceInputData()

SurgSim::DataStructures::DataGroup SurgSim::Devices::RawMultiAxisScaffold::buildDeviceInputData | ( |  | ) |

static private

Builds the data layout for the application input (i.e. device output).

## createPerDeviceThread()

bool SurgSim::Devices::RawMultiAxisScaffold::createPerDeviceThread | ( | DeviceData * | data | ) |

private

Creates the input loop thread.

Returns
  true on success.

## destroyPerDeviceThread()

bool SurgSim::Devices::RawMultiAxisScaffold::destroyPerDeviceThread | ( | DeviceData * | data | ) |

private

Destroys the input loop thread.

Returns
  true on success.

## findUnusedDeviceAndRegister()

bool SurgSim::Devices::RawMultiAxisScaffold::findUnusedDeviceAndRegister | ( | RawMultiAxisDevice * | device,
|  | int * | numUsedDevicesSeen
| ) |  |

private

Scans hardware that is present in the system, and if an unused device is found, register an object for it.

Parameters

  | device | The device object to register if an unused device is found.
  [out] | numUsedDevicesSeen | The number of devices that were found during the scan but were already in use. Can be used if the scan fails to determine the error message that should be displayed.

Returns
  true on success.

## getOrCreateSharedInstance()

std::shared_ptr< RawMultiAxisScaffold > SurgSim::Devices::RawMultiAxisScaffold::getOrCreateSharedInstance | ( |  | ) |

static

Gets or creates the scaffold shared by all RawMultiAxisDevice instances.

The scaffold is managed using a SharedInstance object, so it will be destroyed when all devices are released.

Returns
  the scaffold object.

## openDevice()

std::unique_ptr< SystemInputDeviceHandle > SurgSim::Devices::RawMultiAxisScaffold::openDevice | ( | const std::string & | path | ) |

private

Opens the specified device.

Returns
  The system-specific wrapper for the device.

## registerDevice()

bool SurgSim::Devices::RawMultiAxisScaffold::registerDevice | ( | RawMultiAxisDevice * | device | ) |

private

Registers the specified device object.

If successful, the device object will become connected to an unused hardware device.

Parameters

  device | The device object to be used, which should have a unique name.

Returns
  True if the initialization succeeds, false if it fails.

## registerIfUnused()

bool SurgSim::Devices::RawMultiAxisScaffold::registerIfUnused | ( | const std::string & | path,
|  | RawMultiAxisDevice * | device,
|  | int * | numUsedDevicesSeen
| ) |  |

private

Register a device object given a device path, if the same path is not already in use.

Parameters

  | path | A unique system path that can be used to communicate with the device.
  | device | The device object to register if the index pair is in fact unused.
  [in,out] | numUsedDevicesSeen | The number of devices that were found during the scan but were already in use; incremented when an unused device is seen.

Returns
  true on success.

## runAfterLastFrame()

bool SurgSim::Devices::RawMultiAxisScaffold::runAfterLastFrame | ( | RawMultiAxisScaffold::DeviceData * | info | ) |

private

Executes the operations after the last input frame, as the device input loop thread is shutting down.

Should only be called from the context of the input loop thread.

Parameters

  info | The internal device data.

Returns
  true on success.

## runInputFrame()

bool SurgSim::Devices::RawMultiAxisScaffold::runInputFrame | ( | RawMultiAxisScaffold::DeviceData * | info | ) |

private

Executes the operations for a single input frame for a single device.

Should only be called from the context of the input loop thread.

Parameters

  info | The internal device data.

Returns
  true on success.

## setAxisDominance()

void SurgSim::Devices::RawMultiAxisScaffold::setAxisDominance | ( | const RawMultiAxisDevice * | device,
|  | bool | onOff
| ) |  |

private

Turns on or off the axis dominance setting for this device.

## setOrientationScale()

void SurgSim::Devices::RawMultiAxisScaffold::setOrientationScale | ( | const RawMultiAxisDevice * | device,
|  | double | scale
| ) |  |

private

Sets the orientation scale for this device.

## setPositionScale()

void SurgSim::Devices::RawMultiAxisScaffold::setPositionScale | ( | const RawMultiAxisDevice * | device,
|  | double | scale
| ) |  |

private

Sets the position scale for this device.

## unregisterDevice()

bool SurgSim::Devices::RawMultiAxisScaffold::unregisterDevice | ( | const RawMultiAxisDevice * | device | ) |

private

Unregisters the specified device object.

The corresponding hardware device will become unused, and can be re-registered later.

Parameters

  device | The device object.

Returns
  true on success, false on failure.

## updateDevice()

bool SurgSim::Devices::RawMultiAxisScaffold::updateDevice | ( | RawMultiAxisScaffold::DeviceData * | info | ) |

private

Updates the device information for a single device.

Returns
  true on success.

## Friends And Related Function Documentation

## RawMultiAxisDevice

friend class RawMultiAxisDevice

friend

## RawMultiAxisThread

friend class RawMultiAxisThread

friend

## StateData

friend struct StateData

friend

## Member Data Documentation

## m_logger

std::shared_ptr<SurgSim::Framework::Logger> SurgSim::Devices::RawMultiAxisScaffold::m_logger

private

Logger used by the scaffold and all devices.

## m_state

std::unique_ptr<StateData> SurgSim::Devices::RawMultiAxisScaffold::m_state

private

Internal scaffold state.

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

- SurgSim/Devices/MultiAxis/RawMultiAxisScaffold.h
- SurgSim/Devices/MultiAxis/RawMultiAxisScaffold.cpp