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

◆ on_tick_if()

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

Registers a conditional callback.

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

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) { std::cout << "Threshold exceeded!" << std::endl; },
[](NodeContext& ctx) { return ctx.value > 0.8; }
);
double value
Current sample value.
Definition Node.hpp:40
Base context class for node callbacks.
Definition Node.hpp:30

Reimplemented in MayaFlux::Nodes::Generator::Logic, and MayaFlux::Nodes::ChainNode.

Definition at line 10 of file Node.cpp.

11{
13}
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
Definition Node.hpp:426
bool safe_add_conditional_callback(std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeHook &callback, const NodeCondition &condition)
Safely adds a conditional callback if it doesn't already exist.
Definition NodeUtils.cpp:42

References m_conditional_callbacks, and MayaFlux::Nodes::safe_add_conditional_callback().

+ Here is the call graph for this function: