HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields | Static Public Attributes
tt::detail::observable_proxy< T, Constant > Struct Template Reference

#include <ttauri/observable.hpp>

Public Types

enum class  state_type : uint8_t { read , write , modified }
 
using value_type = T
 

Public Member Functions

 observable_proxy (observable_impl< T > &actual)
 
 observable_proxy (observable_proxy &&)=delete
 
 observable_proxy (observable_proxy const &)=delete
 
void prepare (state_type new_state) const noexcept
 
 operator value_type () const noexcept
 
 operator value_type & () const noexcept
 
 operator value_type const & () const noexcept
 
observable_proxyoperator= (observable_proxy &&other) noexcept
 Copy the value from a temporary proxy.
 
observable_proxyoperator= (observable_proxy const &other) noexcept
 Copy the value from a proxy.
 
template<typename Arg = value_type>
requires (is_variable and not is_atomic and not std::is_same_v<std::remove_cvref_t<Arg>, observable_proxy>)
observable_proxyoperator= (Arg &&arg) noexcept
 
template<typename Arg = value_type>
requires (is_variable and is_atomic and not std::is_same_v<std::remove_cvref_t<Arg>, observable_proxy>)
observable_proxyoperator= (Arg &&arg) noexcept
 
value_type operator* () const noexcept
 
value_type const & operator* () const noexcept
 
value_type & operator* () const noexcept
 
value_type const * operator-> () const noexcept
 
value_type * operator-> () const noexcept
 
template<typename... Args>
decltype(auto) operator() (Args &&...args) const noexcept
 
template<typename Arg >
requires (is_variable and not is_atomic)
decltype(auto) operator[] (Arg &&arg) const noexcept
 
template<typename Arg >
requires (is_constant and not is_atomic)
decltype(auto) operator[] (Arg &&arg) const noexcept
 

Data Fields

observable_impl< value_type > * _actual = nullptr
 
value_type _original
 
state_type _state = state_type::none
 

Static Public Attributes

static constexpr bool is_atomic = std::is_scalar_v<T>
 
static constexpr bool is_constant = Constant
 
static constexpr bool is_variable = not Constant
 

Detailed Description

template<typename T, bool Constant>
struct tt::detail::observable_proxy< T, Constant >

A proxy to the shared-value inside an observable.

This proxy object makes sure that updates to a value is atomic and that modifications causes notifications to be sent.

Template Parameters
TThe type of the observed value.
ConstantTrue when there is read-only access to the value. False if there is read-write access.

Member Function Documentation

◆ operator=() [1/2]

template<typename T , bool Constant>
observable_proxy & tt::detail::observable_proxy< T, Constant >::operator= ( observable_proxy< T, Constant > && other)
inlinenoexcept

Copy the value from a temporary proxy.

◆ operator=() [2/2]

template<typename T , bool Constant>
observable_proxy & tt::detail::observable_proxy< T, Constant >::operator= ( observable_proxy< T, Constant > const & other)
inlinenoexcept

Copy the value from a proxy.


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