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

◆ add_influence()

template<typename T >
std::shared_ptr< Influence< T > > MayaFlux::Nexus::Agent::add_influence ( typename Influence< T >::Producer  producer)
inline

Add an influence of any type, with as many targets as are wanted.

Template Parameters
TType the producer returns; whatever the targets take.
Parameters
producerBuilds the value from the influence context.
Returns
The influence, to add its targets with Influence::add_target.

Runs on every influence after the influence function. Typed influences are runtime objects and are not part of encoded state.

Definition at line 228 of file Agent.hpp.

229 {
230 auto influence = std::make_shared<Influence<T>>(std::move(producer));
231 m_influences.emplace_back(influence,
232 [influence](const InfluenceContext& ctx) { influence->invoke(ctx); });
233 return influence;
234 }
std::vector< std::pair< std::shared_ptr< void >, InfluenceFn > > m_influences
Definition Agent.hpp:397