Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
SurgSim::Devices::KeyboardScaffold Class Reference

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

#include <SurgSim/Devices/Keyboard/KeyboardScaffold.h>

Classes

struct  DeviceData
 Struct to hold a KeyboardDevice object, a KeyboardHandler object, and a mutex for data passing. More...
 

Public Member Functions

 KeyboardScaffold ()
 Constructor. More...
 
 ~KeyboardScaffold ()
 Destructor. More...
 

Static Public Member Functions

static std::shared_ptr< KeyboardScaffoldgetOrCreateSharedInstance ()
 Gets or creates the scaffold shared by all KeyboardDevice instances. More...
 

Private Member Functions

bool registerDevice (KeyboardDevice *device)
 Registers the specified device object. More...
 
bool unregisterDevice ()
 Unregisters the specified device object. More...
 
bool updateDevice (int key, int modifierMask)
 Updates the device information for a single device. More...
 
OsgKeyboardHandlergetKeyboardHandler () const
 Get keyboard 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::Loggerm_logger
 Logger used by the scaffold and all devices. More...
 
std::unique_ptr< DeviceDatam_device
 The keyboard device managed by this scaffold. More...
 

Friends

class KeyboardDevice
 
class KeyboardDeviceTest
 
class OsgKeyboardHandler
 

Detailed Description

A class that implements the behavior of KeyboardDevice objects.

See also
SurgSim::Devices::KeyboardDevice

Constructor & Destructor Documentation

◆ KeyboardScaffold()

SurgSim::Devices::KeyboardScaffold::KeyboardScaffold ( )

Constructor.

◆ ~KeyboardScaffold()

SurgSim::Devices::KeyboardScaffold::~KeyboardScaffold ( )

Destructor.

Member Function Documentation

◆ buildDeviceInputData()

DataStructures::DataGroup SurgSim::Devices::KeyboardScaffold::buildDeviceInputData ( )
staticprivate

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

◆ getKeyboardHandler()

OsgKeyboardHandler * SurgSim::Devices::KeyboardScaffold::getKeyboardHandler ( ) const
private

Get keyboard handler.

Returns
The keyboard handler associated with this device

◆ getOrCreateSharedInstance()

std::shared_ptr< KeyboardScaffold > SurgSim::Devices::KeyboardScaffold::getOrCreateSharedInstance ( )
static

Gets or creates the scaffold shared by all KeyboardDevice 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::KeyboardScaffold::registerDevice ( KeyboardDevice device)
private

Registers the specified device object.

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

Parameters
deviceThe 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::KeyboardScaffold::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::KeyboardScaffold::updateDevice ( int  key,
int  modifierMask 
)
private

Updates the device information for a single device.

Parameters
keyUnmodified OSG key code.
modifierMaskModifier mask.
Returns
True on success.

Friends And Related Function Documentation

◆ KeyboardDevice

friend class KeyboardDevice
friend

◆ KeyboardDeviceTest

friend class KeyboardDeviceTest
friend

◆ OsgKeyboardHandler

friend class OsgKeyboardHandler
friend

Member Data Documentation

◆ m_device

std::unique_ptr<DeviceData> SurgSim::Devices::KeyboardScaffold::m_device
private

The keyboard device managed by this scaffold.

◆ m_logger

std::shared_ptr<SurgSim::Framework::Logger> SurgSim::Devices::KeyboardScaffold::m_logger
private

Logger used by the scaffold and all devices.


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