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

◆ add()

template<typename Op, typename Self, typename... Args>
std::shared_ptr< Op > MayaFlux::Nodes::Network::NodeNetwork::add ( this Self & self,
Args &&... args )
inline

Construct an operator, append it to this network's chain and return it.

An operator that is constructible from a shared_ptr to this concrete network followed by the arguments receives the network as its first argument; any other operator is built from the arguments alone. gong->add<ModalDampingOperator>() therefore needs no network argument, and a host of the wrong type does not compile. The network must be owned by a shared_ptr. Call outside process_batch.

Definition at line 443 of file NodeNetwork.hpp.

444 {
445 std::shared_ptr<Op> op;
446 if constexpr (std::constructible_from<Op, std::shared_ptr<Self>, Args...>) {
447 op = std::make_shared<Op>(
448 std::static_pointer_cast<Self>(self.shared_from_this()),
449 std::forward<Args>(args)...);
450 } else {
451 op = std::make_shared<Op>(std::forward<Args>(args)...);
452 }
453 self.m_operator_chain->add(op);
454 return op;
455 }