21class MAYAFLUX_API
ChainNode :
public Node,
public std::enable_shared_from_this<ChainNode> {
28 ChainNode(
const std::shared_ptr<Node>& source,
const std::shared_ptr<Node>& target);
51 double process_sample(
double input = 0.)
override;
61 std::vector<double> process_batch(
unsigned int num_samples)
override;
74 m_Target->on_tick(callback);
89 m_Target->on_tick_if(condition, callback);
102 return m_Target->remove_hook(callback);
115 return m_Target->remove_conditional_hook(callback);
127 m_Target->remove_all_hooks();
138 void reset_processed_state()
override;
141 void save_state()
override;
142 void restore_state()
override;
187 bool m_state_saved {};
259 BinaryOpContextGpu(
double value,
double lhs_value,
double rhs_value, std::span<const float> gpu_data);
277class MAYAFLUX_API
BinaryOpNode :
public Node,
public std::enable_shared_from_this<BinaryOpNode> {
318 double process_sample(
double input = 0.)
override;
328 std::vector<double> process_batch(
unsigned int num_samples)
override;
338 void reset_processed_state()
override;
340 void save_state()
override;
341 void restore_state()
override;
352 void notify_tick(
double value)
override;
363 void update_context(
double value)
override;
398 double m_last_lhs_value {};
407 double m_last_rhs_value {};
418 bool m_is_initialized {};
420 bool m_state_saved {};
421 double m_saved_last_lhs_value {};
422 double m_saved_last_rhs_value {};
GPU-compatible context for binary operation callbacks.
double rhs_value
The value from the right-hand side node.
double lhs_value
The value from the left-hand side node.
Specialized context for binary operation callbacks.
std::shared_ptr< Node > m_lhs
The left-hand side node.
std::function< double(double, double)> CombineFunc
Function type for combining two node outputs.
CombineFunc m_func
The function used to combine the outputs of both nodes.
BinaryOpContext m_context
std::shared_ptr< Node > m_rhs
The right-hand side node.
BinaryOpContextGpu m_context_gpu
Combines the outputs of two nodes using a binary operation.
std::shared_ptr< Node > m_Source
The upstream node that processes input first.
std::shared_ptr< Node > m_Target
The downstream node that processes the source's output.
void update_context(double) override
Empty implementation of update_context.
void remove_all_hooks() override
Removes all registered callbacks.
void on_tick(const NodeHook &callback) override
Registers a callback for every output sample.
bool m_is_initialized
Flag indicating whether the chain has been properly initialized.
bool remove_hook(const NodeHook &callback) override
Removes a previously registered callback.
bool remove_conditional_hook(const NodeCondition &callback) override
Removes a previously registered conditional callback.
void on_tick_if(const NodeCondition &condition, const NodeHook &callback) override
Registers a conditional callback for output samples.
void notify_tick(double) override
Empty implementation of notify_tick.
Connects two nodes in series to form a processing chain.
GPU-uploadable 1D array data interface.
Base context class for node callbacks.
Base interface for all computational processing nodes.
std::function< void(NodeContext &)> NodeHook
Callback function type for node processing events.
std::function< bool(NodeContext &)> NodeCondition
Predicate function type for conditional callbacks.
Contains the node-based computational processing system components.
bool is_initialized()
Checks if the default engine has been initialized.