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 121 of file Counter.cpp.

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

References MayaFlux::Nodes::Generator::Generator::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: