MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::InputManager Class Reference

Manages input processing thread and node dispatch. More...

#include <InputManager.hpp>

+ Collaboration diagram for MayaFlux::Core::InputManager:

Classes

struct  NodeRegistration
 

Public Member Functions

 InputManager ()
 
 ~InputManager ()
 
 InputManager (const InputManager &)=delete
 
InputManageroperator= (const InputManager &)=delete
 
 InputManager (InputManager &&)=delete
 
InputManageroperator= (InputManager &&)=delete
 
void start ()
 Start the processing thread.
 
void stop ()
 Stop the processing thread.
 
bool is_running () const
 Check if processing thread is running.
 
void enqueue (const InputValue &value)
 Enqueue an input value for processing.
 
void enqueue_batch (const std::vector< InputValue > &values)
 Enqueue multiple input values.
 
void register_node (const std::shared_ptr< Nodes::Input::InputNode > &node, InputBinding binding)
 Register a node to receive input.
 
void unregister_node (const std::shared_ptr< Nodes::Input::InputNode > &node)
 Unregister a node.
 
void unregister_all_nodes ()
 Unregister all nodes.
 
size_t get_registered_node_count () const
 Get count of registered nodes.
 
uint64_t get_events_processed () const
 Get number of events processed since start.
 
size_t get_queue_depth () const
 Get current queue depth.
 

Private Types

using RegistrationList = std::vector< NodeRegistration >
 

Private Member Functions

void processing_loop ()
 
void dispatch_to_nodes (const InputValue &value)
 
bool matches_binding (const InputValue &value, const InputBinding &binding) const
 
std::optional< InputBindingresolve_vid_pid (const InputBinding &binding, const std::vector< InputDeviceInfo > &devices) const
 

Private Attributes

std::thread m_processing_thread
 
std::atomic< bool > m_running { false }
 
std::atomic< bool > m_stop_requested { false }
 
std::atomic< bool > m_queue_notify { false }
 
Memory::LockFreeQueue< InputValue, MAX_QUEUE_SIZEm_queue
 
std::vector< std::shared_ptr< Nodes::Input::InputNode > > m_tracked_nodes
 To keep nodes alive.
 
std::mutex m_registry_mutex
 
std::atomic< std::shared_ptr< const RegistrationList > > m_registrations
 
Registry::Service::InputServicem_input_service { nullptr }
 
std::atomic< uint64_t > m_events_processed { 0 }
 

Static Private Attributes

static constexpr size_t MAX_QUEUE_SIZE = 4096
 

Detailed Description

Manages input processing thread and node dispatch.

InputManager is the core processing entity for input. It:

  • Owns the input processing thread
  • Maintains device→node routing table
  • Receives InputValues from backends via thread-safe queue
  • Dispatches input to registered nodes by calling process_input()

Threading model:

  • Backends push to queue from their threads (thread-safe)
  • Single processing thread dispatches to nodes
  • Node callbacks fire on the processing thread

Owned by InputSubsystem, which handles lifecycle coordination.

Definition at line 33 of file InputManager.hpp.


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