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

◆ on_tick_if()

HookId MayaFlux::Nodes::Node::on_tick_if ( const NodeCondition &  condition,
const NodeHook &  callback 
)
virtual

Registers a conditional callback.

Parameters
conditionPredicate that determines when callback should be triggered
callbackFunction to call when condition is met

Registers a callback function that will be called only when the specified condition is met. The condition is evaluated each time the node produces a new output value, and the callback is triggered only if the condition returns true.

This mechanism enables selective monitoring and reaction to specific node states or events, such as threshold crossings or pattern detection.

Example:

node->on_tick_if(
[](NodeContext& ctx) { return ctx.value > 0.8; },
[](NodeContext& ctx) { std::cout << "Threshold exceeded!" << std::endl; }
);
double value
Current sample value.
Definition Node.hpp:63
Base context class for node callbacks.
Definition Node.hpp:53

Reimplemented in MayaFlux::Nodes::ChainNode.

Definition at line 24 of file Node.cpp.

25{
26 return m_conditional_callbacks.add_conditional_unique(callback, condition, callback.target_type());
27}
PickCallback callback
Definition Picker.cpp:22
HookId add_conditional_unique(NodeHook hook, NodeCondition condition, const std::type_info &key, uint8_t tag=0)
As add_conditional, returning the existing id when the same hook and condition types exist.
HookList m_conditional_callbacks
Hooks fired on a tick only while their condition holds.
Definition Node.hpp:485

References MayaFlux::Nodes::HookList::add_conditional_unique(), callback, and m_conditional_callbacks.

+ Here is the call graph for this function: