MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nexus::Influence< T, Context > Class Template Reference

A value of any type, built from the influence context and handed to its targets. More...

#include <Influence.hpp>

+ Collaboration diagram for MayaFlux::Nexus::Influence< T, Context >:

Public Types

using Producer = std::function< T(const Context &)>
 
using Target = std::function< void(const T &)>
 

Public Member Functions

Influence & add_target (Target target)
 Add a target.
 
void clear_targets ()
 Remove every target.
 
 Influence (Producer producer)
 
void invoke (const Context &ctx) const
 Build the value from ctx and hand it to every target.
 
size_t target_count () const
 Number of targets currently added.
 

Private Attributes

Producer m_producer
 
std::vector< Target > m_targets
 

Detailed Description

template<typename T, typename Context = InfluenceContext>
class MayaFlux::Nexus::Influence< T, Context >

A value of any type, built from the influence context and handed to its targets.

T is whatever the targets need: a struct for a shader block, a vector, a matrix, a Tendency, a DataVariant. A target is any callable taking const T& and decides what the value affects. On each invoke the producer runs once and every target gets the value, in the order they were added.

How many targets an Influence may have is decided by its owner: an Emitter keeps one, an Agent keeps as many as are added.

Context is what the producer reads. Emitter and Agent supply an InfluenceContext, an Expanse supplies a CrossingContext. Targets take only const T&, so one target works with either.

Definition at line 91 of file Influence.hpp.


The documentation for this class was generated from the following file: