26class MAYAFLUX_API
ChainNode :
public Node,
public std::enable_shared_from_this<ChainNode> {
34 explicit ChainNode(std::vector<std::shared_ptr<Node>> nodes);
43 std::vector<std::shared_ptr<Node>> nodes,
53 const std::shared_ptr<Node>& source,
54 const std::shared_ptr<Node>& target);
64 const std::shared_ptr<Node>& source,
65 const std::shared_ptr<Node>& target,
73 void append(
const std::shared_ptr<Node>& node);
79 void append_chain(
const std::shared_ptr<ChainNode>& other);
84 [[nodiscard]]
size_t size()
const {
return m_nodes.size(); }
89 [[nodiscard]]
const std::vector<std::shared_ptr<Node>>&
nodes()
const {
return m_nodes; }
100 double process_sample(
double input = 0.)
override;
101 std::vector<double> process_batch(
unsigned int num_samples)
override;
105 if (!m_nodes.empty())
106 m_nodes.back()->on_tick(callback);
111 if (!m_nodes.empty())
112 m_nodes.back()->on_tick_if(condition, callback);
117 if (!m_nodes.empty())
118 m_nodes.back()->remove_all_hooks();
121 void reset_processed_state()
override;
123 void save_state()
override;
124 void restore_state()
override;
134 bool m_is_initialized {};
135 bool m_state_saved {};
std::vector< std::shared_ptr< Node > > m_nodes
void update_context(double) override
Updates the context object with the current node state.
void remove_all_hooks() override
Removes all registered callbacks.
void on_tick(const NodeHook &callback) override
Registers a callback to be called on each tick.
void on_tick_if(const NodeCondition &condition, const NodeHook &callback) override
Registers a conditional callback.
void notify_tick(double) override
Notifies all registered callbacks with the current context.
const std::vector< std::shared_ptr< Node > > & nodes() const
Returns a const reference to the internal node sequence.
size_t size() const
Returns the number of nodes in the chain.
Connects an ordered sequence of nodes in series.
Base context class for node callbacks.
Central manager for the computational processing node graph.
Base interface for all computational processing nodes.
std::function< void(NodeContext &)> NodeHook
Callback function type for node processing events.
ProcessingToken
Enumerates the different processing domains for nodes.
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.