MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ add_backend()

bool MayaFlux::Core::InputSubsystem::add_backend ( std::unique_ptr< IInputBackend backend)

Add a custom input backend.

Parameters
backendBackend instance (takes ownership)
Returns
true if added successfully

Definition at line 202 of file InputSubsystem.cpp.

203{
204 if (!backend)
205 return false;
206
207 InputType type = backend->get_type();
208
209 std::unique_lock lock(m_backends_mutex);
210
211 if (m_backends.find(type) != m_backends.end()) {
213 "Backend type {} already registered", static_cast<int>(type));
214 return false;
215 }
216
217 if (!backend->initialize()) {
219 "Failed to initialize backend: {}", backend->get_name());
220 return false;
221 }
222
223 wire_backend_to_manager(backend.get());
224
225 m_backends[type] = std::move(backend);
226
228 "Added input backend: {}", m_backends[type]->get_name());
229
230 return true;
231}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::unordered_map< InputType, std::unique_ptr< IInputBackend > > m_backends
void wire_backend_to_manager(IInputBackend *backend)
InputType
Input backend type enumeration.
@ InputSubsystem
Input subsystem operations (device management, event dispatch)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::InputSubsystem, m_backends, m_backends_mutex, MF_ERROR, MF_INFO, MF_WARN, and wire_backend_to_manager().

Referenced by initialize_hid_backend(), and initialize_midi_backend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: