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

◆ notify_tick()

void MayaFlux::Nodes::Generator::Counter::notify_tick ( double  value)
overrideprotectedvirtual

Notifies all registered callbacks with the current context.

Parameters
valueThe current sample value

This method is called by the node implementation when a new output value is produced. It creates a context object using create_context(), then calls all registered callbacks with that context.

For unconditional callbacks (registered with on_tick()), the callback is always called. For conditional callbacks (registered with on_tick_if()), the callback is called only if its condition returns true.

Node implementations should call this method at appropriate points in their processing flow to trigger callbacks.

Implements MayaFlux::Nodes::Node.

Definition at line 119 of file Counter.cpp.

120{
121 update_context(value);
122 auto& ctx = get_last_context();
123 auto& gc = dynamic_cast<GeneratorContext&>(ctx);
124
125 for (auto& cb : m_callbacks) {
126 cb(ctx);
127 }
128 for (auto& [cb, cond] : m_conditional_callbacks) {
129 if (cond(ctx)) {
130 cb(ctx);
131 }
132 }
133 for (auto& cb : m_increment_callbacks) {
134 cb(gc);
135 }
136 if (m_wrapped) {
137 for (auto& cb : m_wrap_callbacks) {
138 cb(gc);
139 }
140 }
141 for (auto& [target, cb] : m_count_callbacks) {
142 if (m_count == target) {
143 cb(gc);
144 }
145 }
146}
std::vector< TypedHook< GeneratorContext > > m_increment_callbacks
Definition Counter.hpp:136
std::vector< TypedHook< GeneratorContext > > m_wrap_callbacks
Definition Counter.hpp:137
void update_context(double value) override
Updates the context object for callbacks.
Definition Counter.cpp:148
std::vector< std::pair< uint32_t, TypedHook< GeneratorContext > > > m_count_callbacks
Definition Counter.hpp:138
NodeContext & get_last_context() override
Retrieves the last created context object.
Definition Counter.cpp:153
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
Definition Node.hpp:426
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
Definition Node.hpp:436

References get_last_context(), MayaFlux::Nodes::Node::m_callbacks, MayaFlux::Nodes::Node::m_conditional_callbacks, m_count, m_count_callbacks, m_increment_callbacks, m_wrap_callbacks, m_wrapped, and update_context().

Referenced by process_sample().

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