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

◆ unregister_node()

void MayaFlux::Core::InputManager::unregister_node ( const std::shared_ptr< Nodes::Input::InputNode > &  node)

Unregister a node.

Parameters
nodeThe node to unregister

Removes the node from all bindings.

Definition at line 215 of file InputManager.cpp.

216{
217 if (!node)
218 return;
219
220 {
221 std::lock_guard lock(m_registry_mutex);
222
223#ifdef MAYAFLUX_PLATFORM_MACOS
224 auto* old_list = m_registrations.load();
225 auto* new_list = new RegistrationList(*old_list);
226
227 new_list->erase(
228 std::remove_if(new_list->begin(), new_list->end(),
229 [&node](const NodeRegistration& reg) {
230 auto locked = reg.node.lock();
231 return !locked || locked == node;
232 }),
233 new_list->end());
234
235 m_registrations.store(new_list);
236 retire_list(old_list);
237#else
238 auto current_list = m_registrations.load();
239 auto new_list = std::make_shared<RegistrationList>(*current_list);
240
241 new_list->erase(
242 std::remove_if(new_list->begin(), new_list->end(),
243 [&node](const NodeRegistration& reg) {
244 auto locked = reg.node.lock();
245 return !locked || locked == node;
246 }),
247 new_list->end());
248
249 m_registrations.store(new_list);
250#endif
251 m_tracked_nodes.erase(
252 std::remove(m_tracked_nodes.begin(), m_tracked_nodes.end(), node),
253 m_tracked_nodes.end());
254 }
255
257 "Unregistered InputNode");
258}
#define MF_DEBUG(comp, ctx,...)
std::vector< NodeRegistration > RegistrationList
std::atomic< std::shared_ptr< const RegistrationList > > m_registrations
std::vector< std::shared_ptr< Nodes::Input::InputNode > > m_tracked_nodes
To keep nodes alive.
@ InputManagement
Input management (Core::InputManager)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::InputManagement, m_registrations, m_registry_mutex, m_tracked_nodes, and MF_DEBUG.

Referenced by MayaFlux::unregister_input_node().

+ Here is the caller graph for this function: