All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
SurgSim::Device::KeyboardScaffold Class Reference

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

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

Collaboration diagram for SurgSim::Device::KeyboardScaffold:
Collaboration graph
[legend]

Classes

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

Public Member Functions

 KeyboardScaffold (std::shared_ptr< SurgSim::Framework::Logger > logger=nullptr)
 Constructor. More...
 
 ~KeyboardScaffold ()
 Destructor. More...
 
std::shared_ptr
< SurgSim::Framework::Logger
getLogger () const
 Gets the logger used by this object and the devices it manages. More...
 

Static Public Member Functions

static std::shared_ptr
< KeyboardScaffold
getOrCreateSharedInstance ()
 Gets or creates the scaffold shared by all KeyboardDevice instances. More...
 
static void setDefaultLogLevel (SurgSim::Framework::LogLevel logLevel)
 Sets the default log level. 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::Logger
m_logger
 Logger used by the scaffold and all devices. More...
 
std::unique_ptr< DeviceDatam_device
 The keyboard device managed by this scaffold. More...
 

Static Private Attributes

static SurgSim::Framework::LogLevel m_defaultLogLevel = SurgSim::Framework::LOG_LEVEL_INFO
 The default logging level. More...
 

Friends

class KeyboardDevice
 
class KeyboardDeviceTest
 
class OsgKeyboardHandler
 

Detailed Description

A class that implements the behavior of KeyboardDevice objects.

See also
SurgSim::Device::KeyboardDevice

Constructor & Destructor Documentation

SurgSim::Device::KeyboardScaffold::KeyboardScaffold ( std::shared_ptr< SurgSim::Framework::Logger logger = nullptr)
explicit

Constructor.

Parameters
logger(optional) The logger to be used by the scaffold object and the devices it manages. If unspecified or empty, a console logger will be created and used.
SurgSim::Device::KeyboardScaffold::~KeyboardScaffold ( )

Destructor.

Member Function Documentation

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

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

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

Get keyboard handler.

Returns
The keyboard handler associated with this device
std::shared_ptr< SurgSim::Framework::Logger > SurgSim::Device::KeyboardScaffold::getLogger ( ) const

Gets the logger used by this object and the devices it manages.

Returns
The logger.
std::shared_ptr< KeyboardScaffold > SurgSim::Device::KeyboardScaffold::getOrCreateSharedInstance ( )
static

Gets or creates the scaffold shared by all KeyboardDevice instances.

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

Returns
the scaffold object.
bool SurgSim::Device::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.
void SurgSim::Device::KeyboardScaffold::setDefaultLogLevel ( SurgSim::Framework::LogLevel  logLevel)
static

Sets the default log level.

Has no effect unless called before a scaffold is created (i.e. before the first device).

Parameters
logLevelThe log level.
bool SurgSim::Device::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.
bool SurgSim::Device::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

friend class KeyboardDevice
friend
friend class KeyboardDeviceTest
friend
friend class OsgKeyboardHandler
friend

Member Data Documentation

SurgSim::Framework::LogLevel SurgSim::Device::KeyboardScaffold::m_defaultLogLevel = SurgSim::Framework::LOG_LEVEL_INFO
staticprivate

The default logging level.

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

The keyboard device managed by this scaffold.

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

Logger used by the scaffold and all devices.


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