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

◆ safe_add_callback()

template<typename ContextT >
bool MayaFlux::Nodes::safe_add_callback ( std::vector< TypedHook< ContextT > > &  callbacks,
const TypedHook< ContextT > &  callback 
)

Adds a callback to the collection if an equivalent one is not already present.

Returns
True if added, false if a duplicate was detected.

Definition at line 77 of file NodeUtils.hpp.

79{
80 if (!callback_exists(callbacks, callback)) {
81 callbacks.push_back(callback);
82 return true;
83 }
84 return false;
85}
bool callback_exists(const std::vector< TypedHook< ContextT > > &callbacks, const TypedHook< ContextT > &callback)
Returns true if an equivalent callback is already present in the collection.
Definition NodeUtils.hpp:63

References callback_exists().

Referenced by MayaFlux::Nodes::Generator::Impulse::on_impulse(), MayaFlux::Nodes::Generator::Phasor::on_phase_wrap(), and MayaFlux::Nodes::Node::on_tick().

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