libvirtualhid latest
Cross-platform C++ library for virtual HID devices.
lvh::Runtime Class Referencefinal

Runtime that owns backend state and creates virtual devices. More...

#include <src/include/libvirtualhid/runtime.hpp>

Public Member Functions

std::size_t active_device_count () const
 Get the number of open devices owned by the runtime.
 
BackendKind backend_kind () const
 Get the backend kind used by this runtime.
 
const BackendCapabilitiescapabilities () const
 Get capabilities for the selected backend.
 
void close_all ()
 Close every device owned by the runtime.
 
GamepadCreationResult create_gamepad (const CreateGamepadOptions &options)
 Create a gamepad from full creation options.
 
GamepadCreationResult create_gamepad (const DeviceProfile &profile)
 Create a gamepad from a profile.
 
KeyboardCreationResult create_keyboard ()
 Create a keyboard with the built-in keyboard profile.
 
KeyboardCreationResult create_keyboard (const CreateKeyboardOptions &options)
 Create a keyboard from full creation options.
 
MouseCreationResult create_mouse ()
 Create a mouse with the built-in mouse profile.
 
MouseCreationResult create_mouse (const CreateMouseOptions &options)
 Create a mouse from full creation options.
 
PenTabletCreationResult create_pen_tablet ()
 Create a pen tablet with the built-in pen tablet profile.
 
PenTabletCreationResult create_pen_tablet (const CreatePenTabletOptions &options)
 Create a pen tablet from full creation options.
 
TouchscreenCreationResult create_touchscreen ()
 Create a touchscreen with the built-in touchscreen profile.
 
TouchscreenCreationResult create_touchscreen (const CreateTouchscreenOptions &options)
 Create a touchscreen from full creation options.
 
TrackpadCreationResult create_trackpad ()
 Create a trackpad with the built-in trackpad profile.
 
TrackpadCreationResult create_trackpad (const CreateTrackpadOptions &options)
 Create a trackpad from full creation options.
 
Runtimeoperator= (const Runtime &)=delete
 Copy assignment is disabled because the runtime owns backend state.
 
Runtimeoperator= (Runtime &&other) noexcept
 Move assign a runtime.
 
 Runtime (const Runtime &)=delete
 Copy construction is disabled because the runtime owns backend state.
 
 Runtime (detail::RuntimeConstructionToken token, RuntimeOptions options)
 Construct a runtime for Runtime::create.
 
 Runtime (Runtime &&other) noexcept
 Move construct a runtime.
 
 ~Runtime ()
 Destroy the runtime and close any remaining devices.
 

Static Public Member Functions

static std::unique_ptr< Runtimecreate (RuntimeOptions options={})
 Create a runtime with the requested options.
 

Detailed Description

Runtime that owns backend state and creates virtual devices.

Constructor & Destructor Documentation

◆ Runtime() [1/2]

lvh::Runtime::Runtime ( Runtime && other)
noexcept

Move construct a runtime.

Parameters
otherRuntime to move from.

◆ Runtime() [2/2]

lvh::Runtime::Runtime ( detail::RuntimeConstructionToken token,
RuntimeOptions options )

Construct a runtime for Runtime::create.

Parameters
tokenRuntime construction token.
optionsRuntime configuration.

Member Function Documentation

◆ active_device_count()

std::size_t lvh::Runtime::active_device_count ( ) const

Get the number of open devices owned by the runtime.

Returns
Active device count.

◆ backend_kind()

BackendKind lvh::Runtime::backend_kind ( ) const

Get the backend kind used by this runtime.

Returns
Backend kind.

◆ capabilities()

const BackendCapabilities & lvh::Runtime::capabilities ( ) const

Get capabilities for the selected backend.

Returns
Backend capabilities.

◆ create()

static std::unique_ptr< Runtime > lvh::Runtime::create ( RuntimeOptions options = {})
static

Create a runtime with the requested options.

Parameters
optionsRuntime creation options.
Returns
Runtime instance.

◆ create_gamepad() [1/2]

GamepadCreationResult lvh::Runtime::create_gamepad ( const CreateGamepadOptions & options)

Create a gamepad from full creation options.

Parameters
optionsGamepad creation options.
Returns
Gamepad creation result.

◆ create_gamepad() [2/2]

GamepadCreationResult lvh::Runtime::create_gamepad ( const DeviceProfile & profile)

Create a gamepad from a profile.

Parameters
profileDevice profile.
Returns
Gamepad creation result.

◆ create_keyboard() [1/2]

KeyboardCreationResult lvh::Runtime::create_keyboard ( )

Create a keyboard with the built-in keyboard profile.

Returns
Keyboard creation result.

◆ create_keyboard() [2/2]

KeyboardCreationResult lvh::Runtime::create_keyboard ( const CreateKeyboardOptions & options)

Create a keyboard from full creation options.

Parameters
optionsKeyboard creation options.
Returns
Keyboard creation result.

◆ create_mouse() [1/2]

MouseCreationResult lvh::Runtime::create_mouse ( )

Create a mouse with the built-in mouse profile.

Returns
Mouse creation result.

◆ create_mouse() [2/2]

MouseCreationResult lvh::Runtime::create_mouse ( const CreateMouseOptions & options)

Create a mouse from full creation options.

Parameters
optionsMouse creation options.
Returns
Mouse creation result.

◆ create_pen_tablet() [1/2]

PenTabletCreationResult lvh::Runtime::create_pen_tablet ( )

Create a pen tablet with the built-in pen tablet profile.

Returns
Pen tablet creation result.

◆ create_pen_tablet() [2/2]

PenTabletCreationResult lvh::Runtime::create_pen_tablet ( const CreatePenTabletOptions & options)

Create a pen tablet from full creation options.

Parameters
optionsPen tablet creation options.
Returns
Pen tablet creation result.

◆ create_touchscreen() [1/2]

TouchscreenCreationResult lvh::Runtime::create_touchscreen ( )

Create a touchscreen with the built-in touchscreen profile.

Returns
Touchscreen creation result.

◆ create_touchscreen() [2/2]

TouchscreenCreationResult lvh::Runtime::create_touchscreen ( const CreateTouchscreenOptions & options)

Create a touchscreen from full creation options.

Parameters
optionsTouchscreen creation options.
Returns
Touchscreen creation result.

◆ create_trackpad() [1/2]

TrackpadCreationResult lvh::Runtime::create_trackpad ( )

Create a trackpad with the built-in trackpad profile.

Returns
Trackpad creation result.

◆ create_trackpad() [2/2]

TrackpadCreationResult lvh::Runtime::create_trackpad ( const CreateTrackpadOptions & options)

Create a trackpad from full creation options.

Parameters
optionsTrackpad creation options.
Returns
Trackpad creation result.

◆ operator=() [1/2]

Runtime & lvh::Runtime::operator= ( const Runtime & )
delete

Copy assignment is disabled because the runtime owns backend state.

Returns
This runtime.

◆ operator=() [2/2]

Runtime & lvh::Runtime::operator= ( Runtime && other)
noexcept

Move assign a runtime.

Parameters
otherRuntime to move from.
Returns
This runtime.

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