MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
NodeOperators.cpp
Go to the documentation of this file.
1#include "NodeOperators.hpp"
3#include "NodeStructure.hpp"
4
5namespace MayaFlux::Nodes {
6
7std::shared_ptr<Node> operator>>(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs)
8{
9 auto chain = std::make_shared<ChainNode>(lhs, rhs);
10 chain->initialize();
11 return chain;
12}
13
14std::shared_ptr<Node> operator+(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs)
15{
16 auto result = std::make_shared<BinaryOpNode>(lhs, rhs, [](double a, double b) { return a + b; });
17 result->initialize();
18 return result;
19}
20
21std::shared_ptr<Node> operator*(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs)
22{
23 auto result = std::make_shared<BinaryOpNode>(lhs, rhs, [](double a, double b) { return a * b; });
24 result->initialize();
25 return result;
26}
27
28void operator*(std::shared_ptr<Node> node, double value)
29{
30 if (auto gen = std::dynamic_pointer_cast<Generator::Generator>(node)) {
31 gen->set_amplitude(value);
32 } else {
33 std::cerr << "Error: Cannot multiply non-generator node by a scalar\n."
34 << "Either use one of the set_[params] methods, or use the appropriate node to create BinaryOpNode" << std::endl;
35 }
36}
37
38}
std::shared_ptr< Node > operator>>(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Connects two nodes in series (pipeline operator)
std::shared_ptr< Node > operator+(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Combines two nodes in parallel (addition operator)
std::shared_ptr< Node > operator*(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Multiplies the outputs of two nodes (multiplication operator)
Contains the node-based computational processing system components.
Definition Chronie.hpp:5