MayaFlux 0.3.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 328 of file Graph.cpp.

329{
330 auto manager = get_node_graph_manager();
331
332 auto lhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(lhs);
333 auto rhs_chain = std::dynamic_pointer_cast<Nodes::ChainNode>(rhs);
334
335 if (lhs_chain) {
336 if (rhs_chain) {
337 lhs_chain->append_chain(rhs_chain);
338 } else {
339 lhs_chain->append(rhs);
340 }
341 lhs_chain->initialize();
342 return lhs_chain;
343 }
344
345 std::shared_ptr<Nodes::ChainNode> chain;
346 if (rhs_chain) {
347 std::vector<std::shared_ptr<Nodes::Node>> nodes;
348 nodes.reserve(1 + rhs_chain->size());
349 nodes.push_back(lhs);
350 for (auto& node : rhs_chain->nodes()) {
351 nodes.push_back(node);
352 }
353 chain = std::make_shared<Nodes::ChainNode>(std::move(nodes), *manager);
354 } else {
355 chain = std::make_shared<Nodes::ChainNode>(lhs, rhs, *manager);
356 }
357
358 chain->initialize();
359 return chain;
360}
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: