Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Input::InputBindingScope Class Reference

RAII owner for input provider and callback registrations. More...

#include <InputManager.h>

Collaboration diagram for Input::InputBindingScope:

Public Member Functions

 InputBindingScope ()=default
 Creates an unbound scope.
 InputBindingScope (InputManager &inputManager)
 Creates a scope bound to an input manager.
 InputBindingScope (const InputBindingScope &)=delete
 Input binding scopes own registrations and cannot be copied.
InputBindingScope & operator= (const InputBindingScope &)=delete
 Input binding scopes own registrations and cannot be copied.
 InputBindingScope (InputBindingScope &&other) noexcept
 Moves ownership of tracked registrations from another scope.
InputBindingScope & operator= (InputBindingScope &&other) noexcept
 Removes current registrations, then moves registrations from another scope.
 ~InputBindingScope ()
 Removes tracked registrations.
void add (InputManager &inputManager, InputManager::ProviderHandle handle)
 Tracks a provider registration for automatic removal.
void add (InputManager &inputManager, InputManager::CallbackHandle handle)
 Tracks a callback registration for automatic removal.
void reset ()
 Removes all tracked registrations and unbinds the scope.

Private Member Functions

void bindTo (InputManager &inputManager)
 Binds this scope to a manager, resetting existing registrations when the manager changes.

Private Attributes

InputManager * inputManager_ = nullptr
 Manager that owns the tracked handles, or nullptr when unbound.
std::vector< InputManager::ProviderHandle > providerHandles_
 Provider handles removed by reset().
std::vector< InputManager::CallbackHandle > callbackHandles_
 Callback handles removed by reset().

Detailed Description

RAII owner for input provider and callback registrations.

Add handles returned by InputManager to the scope. The scope removes those registrations when InputBindingScope::reset() runs or when the scope is destroyed.

A scope is bound to one InputManager at a time. Adding a handle from a different manager resets the current registrations before binding to the new manager.

Definition at line 407 of file InputManager.h.

Constructor & Destructor Documentation

◆ InputBindingScope() [1/4]

Input::InputBindingScope::InputBindingScope ( )
default

Creates an unbound scope.

Referenced by InputBindingScope(), InputBindingScope(), operator=(), and operator=().

Here is the caller graph for this function:

◆ InputBindingScope() [2/4]

Input::InputBindingScope::InputBindingScope ( InputManager & inputManager)
explicit

Creates a scope bound to an input manager.

Parameters
inputManagerManager used by later registrations added without rebinding.

◆ InputBindingScope() [3/4]

Input::InputBindingScope::InputBindingScope ( const InputBindingScope & )
delete

Input binding scopes own registrations and cannot be copied.

References InputBindingScope().

Here is the call graph for this function:

◆ InputBindingScope() [4/4]

Input::InputBindingScope::InputBindingScope ( InputBindingScope && other)
noexcept

Moves ownership of tracked registrations from another scope.

Parameters
otherScope to move from. The moved-from scope becomes unbound.

References InputBindingScope().

Here is the call graph for this function:

◆ ~InputBindingScope()

Input::InputBindingScope::~InputBindingScope ( )

Removes tracked registrations.

Member Function Documentation

◆ add() [1/2]

void Input::InputBindingScope::add ( InputManager & inputManager,
InputManager::CallbackHandle handle )

Tracks a callback registration for automatic removal.

Parameters
inputManagerManager that owns the callback handle.
handleCallback handle returned by an InputManager on-action function.

Invalid handles are ignored. Passing a different manager resets all currently tracked registrations first.

◆ add() [2/2]

void Input::InputBindingScope::add ( InputManager & inputManager,
InputManager::ProviderHandle handle )

Tracks a provider registration for automatic removal.

Parameters
inputManagerManager that owns the provider handle.
handleProvider handle returned by an InputManager bind function.

Invalid handles are ignored. Passing a different manager resets all currently tracked registrations first.

◆ bindTo()

void Input::InputBindingScope::bindTo ( InputManager & inputManager)
private

Binds this scope to a manager, resetting existing registrations when the manager changes.

Parameters
inputManagerManager that owns subsequently tracked handles.

◆ operator=() [1/2]

InputBindingScope & Input::InputBindingScope::operator= ( const InputBindingScope & )
delete

Input binding scopes own registrations and cannot be copied.

References InputBindingScope().

Here is the call graph for this function:

◆ operator=() [2/2]

InputBindingScope & Input::InputBindingScope::operator= ( InputBindingScope && other)
noexcept

Removes current registrations, then moves registrations from another scope.

Parameters
otherScope to move from. The moved-from scope becomes unbound.
Returns
Reference to this scope.

References InputBindingScope().

Here is the call graph for this function:

◆ reset()

void Input::InputBindingScope::reset ( )

Removes all tracked registrations and unbinds the scope.

Calling reset on an unbound or already reset scope only clears stored handles.

Member Data Documentation

◆ callbackHandles_

std::vector<InputManager::CallbackHandle> Input::InputBindingScope::callbackHandles_
private

Callback handles removed by reset().

Definition at line 479 of file InputManager.h.

◆ inputManager_

InputManager* Input::InputBindingScope::inputManager_ = nullptr
private

Manager that owns the tracked handles, or nullptr when unbound.

Definition at line 477 of file InputManager.h.

◆ providerHandles_

std::vector<InputManager::ProviderHandle> Input::InputBindingScope::providerHandles_
private

Provider handles removed by reset().

Definition at line 478 of file InputManager.h.


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Input/InputManager.h