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

◆ set_perception()

template<typename T >
void MayaFlux::Nexus::Sensor::set_perception ( typename Perception< T >::Source  source,
typename Perception< T >::Target  target 
)
inline

Set the one source of a perception of any type.

Template Parameters
TType the source returns; whatever the target takes.
Parameters
sourceReads the value, using the perception context.
targetTakes the value and decides where it lands.

A Sensor has a single source: setting another replaces it. Runs on every invoke before the perception function. Not part of encoded state.

Definition at line 110 of file Sensor.hpp.

111 {
112 auto perception = std::make_shared<Perception<T>>(std::move(source));
113 perception->add_target(std::move(target));
114 m_perception = [perception](const PerceptionContext& ctx) { perception->invoke(ctx); };
115 }
PerceptionFn m_perception
Definition Sensor.hpp:139