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

◆ operator>>()

MAYAFLUX_API std::shared_ptr< Nodes::Node > MayaFlux::operator>> ( const std::shared_ptr< Nodes::Node > &  lhs,
const std::shared_ptr< Nodes::Node > &  rhs 
)

Connects two nodes in series (pipeline operator)

Parameters
lhsSource node (may already be a ChainNode)
rhsTarget node (may already be a ChainNode)
Returns
A ChainNode containing the flattened sequence

If lhs is already a ChainNode, rhs is appended to its sequence rather than creating a nested chain.

Uses the default engine's NodeGraphManager for registration. For manual construction without registration, create ChainNode directly with no manager argument.

auto chain = generator >> transformer >> output;

Definition at line 342 of file Graph.cpp.

343{
344 auto manager = get_node_graph_manager();
345
346 auto lhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(lhs);
347 auto rhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(rhs);
348
349 if (lhs_chain) {
350 if (rhs_chain) {
351 lhs_chain->append_chain(rhs_chain);
352 } else {
353 lhs_chain->append(rhs);
354 }
355 lhs_chain->initialize();
356 return lhs_chain;
357 }
358
359 std::shared_ptr<Nodes::ChainNode> chain;
360 if (rhs_chain) {
361 std::vector<std::shared_ptr<Nodes::Node>> nodes;
362 nodes.reserve(1 + rhs_chain->size());
363 nodes.push_back(lhs);
364 for (auto& node : rhs_chain->nodes()) {
365 nodes.push_back(node);
366 }
367 chain = std::make_shared<Nodes::ChainNode>(std::move(nodes), *manager);
368 } else {
369 chain = std::make_shared<Nodes::ChainNode>(lhs, rhs, *manager);
370 }
371
372 chain->initialize();
373 return chain;
374}
Tendency< A, C > chain(const Tendency< A, B > &first, const Tendency< B, C > &second)
Sequential composition: evaluate first, feed result into second.
Definition Tendency.hpp:82
std::shared_ptr< Nodes::NodeGraphManager > get_node_graph_manager()
Gets the node graph manager from the default engine.
Definition Graph.cpp:35

References get_node_graph_manager().

+ Here is the call graph for this function: