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

◆ operator>>() [1/2]

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 343 of file Graph.cpp.

344{
345 auto manager = get_node_graph_manager();
346
347 auto lhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(lhs);
348 auto rhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(rhs);
349
350 if (lhs_chain) {
351 if (rhs_chain) {
352 lhs_chain->append_chain(rhs_chain);
353 } else {
354 lhs_chain->append(rhs);
355 }
356 lhs_chain->initialize();
357 return lhs_chain;
358 }
359
360 std::shared_ptr<Nodes::ChainNode> chain;
361 if (rhs_chain) {
362 std::vector<std::shared_ptr<Nodes::Node>> nodes;
363 nodes.reserve(1 + rhs_chain->size());
364 nodes.push_back(lhs);
365 for (auto& node : rhs_chain->nodes()) {
366 nodes.push_back(node);
367 }
368 chain = std::make_shared<Nodes::ChainNode>(std::move(nodes), *manager);
369 } else {
370 chain = std::make_shared<Nodes::ChainNode>(lhs, rhs, *manager);
371 }
372
373 chain->initialize();
374 return chain;
375}
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: