SurgSim::Devices::MouseScaffold Class Reference

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

`#include <SurgSim/Devices/Mouse/MouseScaffold.h>`

## Classes

struct | DeviceData
| Struct to hold a MouseDevice object, a OsgMouseHandler, and a mutex for data passing. More...

## Public Member Functions

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

## Static Public Member Functions

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

## Private Member Functions

bool | registerDevice (MouseDevice *device)
| Registers the specified device object. More...
bool | unregisterDevice ()
| Unregisters the specified device object. More...
bool | updateDevice (int buttons, float x, float y, int scrollDeltaX, int scrollDeltaY)
| Updates the device information for a single device. More...
OsgMouseHandler * | getMouseHandler () const
| Get mouse handler. 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< DeviceData > | m_device
| The mouse device managed by this scaffold. More...

## Friends

class | MouseDevice
class | MouseDeviceTest
class | OsgMouseHandler

## Detailed Description

A class that implements the behavior of MouseDevice objects.

See also
  SurgSim::Devices::MouseDevice

## Constructor & Destructor Documentation

## MouseScaffold()

SurgSim::Devices::MouseScaffold::MouseScaffold | ( |  | ) |

Constructor.

## ~MouseScaffold()

SurgSim::Devices::MouseScaffold::~MouseScaffold | ( |  | ) |

Destructor.

## Member Function Documentation

## buildDeviceInputData()

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

static private

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

## getMouseHandler()

OsgMouseHandler * SurgSim::Devices::MouseScaffold::getMouseHandler | ( |  | ) | const

private

Get mouse handler.

Returns
  The mouse handler associated with this device

## getOrCreateSharedInstance()

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

static

Gets or creates the scaffold shared by all MouseDevice instances.

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

Returns
  the scaffold object.

## registerDevice()

bool SurgSim::Devices::MouseScaffold::registerDevice | ( | MouseDevice * | device | ) |

private

Registers the specified device object.

If successful, the device object will become connected to an 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.

## unregisterDevice()

bool SurgSim::Devices::MouseScaffold::unregisterDevice | ( |  | ) |

private

Unregisters the specified device object.

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

Returns
  True on success, false on failure.

## updateDevice()

bool SurgSim::Devices::MouseScaffold::updateDevice | ( | int | buttons,
|  | float | x,
|  | float | y,
|  | int | scrollDeltaX,
|  | int | scrollDeltaY
| ) |  |

private

Updates the device information for a single device.

Parameters

  buttons | Buttons being pressed.
  x | X-Coordinate for the device.
  y | Y-Coordinate for the device.
  scrollDeltaX | Horizontal indicator for mouse wheel.
  scrollDeltaY | Vertical indicator for mouse wheel.

Returns
  True on success.

## Friends And Related Function Documentation

## MouseDevice

friend class MouseDevice

friend

## MouseDeviceTest

friend class MouseDeviceTest

friend

## OsgMouseHandler

friend class OsgMouseHandler

friend

## Member Data Documentation

## m_device

std::unique_ptr<DeviceData> SurgSim::Devices::MouseScaffold::m_device

private

The mouse device managed by this scaffold.

## m_logger

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

private

Logger used by the scaffold and all devices.

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

- SurgSim/Devices/Mouse/MouseScaffold.h
- SurgSim/Devices/Mouse/MouseScaffold.cpp