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

One pending value of any copyable type, such as a string or a list, set from any thread. More...

#include <ControlSnapshot.hpp>

Collaboration diagram for MayaFlux::ControlSnapshot< T >:

Public Member Functions

void assign (const ControlSnapshot &incoming)
 Takes the value incoming holds, so the next due() is true.
 ControlSnapshot ()=default
 ControlSnapshot (const ControlSnapshot &other)
 ControlSnapshot (ControlSnapshot &&other)
 ControlSnapshot (T initial)
bool due () const noexcept
 True when a consumer should apply this value now.
bool has_value () const noexcept
 True once a value was given.
ControlSnapshot & operator= (const ControlSnapshot &other)
ControlSnapshot & operator= (ControlSnapshot &&other)
std::shared_ptr< const T > pending () noexcept
 The value to apply now, or null when nothing is due.
void refresh () noexcept
 Nothing to read from a source.
void set (T value)
 Replaces the value, so the next due() is true.
void settle () noexcept
 Marks the current value as applied.
std::shared_ptr< const T > value () const noexcept
 The current value, or null when none was given.
 ~ControlSnapshot ()=default

Private Member Functions

void copy_state (const ControlSnapshot &other)

Private Attributes

Memory::SnapshotCell< std::shared_ptr< const T > > m_cell
std::atomic< bool > m_dirty { false }
std::atomic< bool > m_set { false }

Detailed Description

template<typename T>
class MayaFlux::ControlSnapshot< T >

One pending value of any copyable type, such as a string or a list, set from any thread.

The counterpart of ControlValue for what does not fit six double lanes. A value is published as one immutable snapshot, so a reader never sees it half written, and a later value replaces one that nothing has applied yet. The consumer takes it once per change with pending(), or reads the current one with value(). It satisfies ControlSlot, so a ControlValueStore can hold it, but not NumericControlSlot, so it has no named number access.

Template Parameters
TA copyable value type.

Definition at line 21 of file ControlSnapshot.hpp.


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