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

◆ safe_remove_callback()

bool MayaFlux::Nodes::safe_remove_callback ( std::vector< NodeHook > &  callbacks,
const NodeHook callback 
)

Safely removes a callback from a collection.

Parameters
callbacksThe collection of callbacks to remove from
callbackThe callback function to remove
Returns
True if the callback was found and removed, false otherwise

This function searches for the specified callback in the collection and removes it if found. It's used to unregister callbacks when they're no longer needed.

Definition at line 51 of file NodeUtils.cpp.

52{
53 bool removed = false;
54 auto it = callbacks.begin();
55
56 while (it != callbacks.end()) {
57 if (it->target_type() == callback.target_type()) {
58 it = callbacks.erase(it);
59 removed = true;
60 } else {
61 ++it;
62 }
63 }
64
65 return removed;
66}

Referenced by MayaFlux::Nodes::Node::remove_hook(), MayaFlux::Nodes::Generator::Impulse::remove_hook(), and MayaFlux::Nodes::Generator::Phasor::remove_hook().

+ Here is the caller graph for this function: