HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends
tt::observable< T > Class Template Reference

Public Types

using value_type = T
 
using notifier_type = notifier<void()>
 
using callback_type = typename notifier_type::callback_type
 
using callback_ptr_type = typename notifier_type::callback_ptr_type
 
using time_point = hires_utc_clock::time_point
 
using duration = hires_utc_clock::duration
 

Public Member Functions

 observable (observable const &other) noexcept
 
observableoperator= (observable const &other) noexcept
 
 observable (value_type const &value) noexcept
 
observableoperator= (value_type const &value) noexcept
 
observableoperator+= (value_type const &value) noexcept
 
value_type previous_value () const noexcept
 
time_point time_when_last_modified () const noexcept
 Time when the value was modified last.
 
duration duration_since_last_modified () const noexcept
 Duration since the value was last modified.
 
float animation_progress (duration animation_duration) const noexcept
 The relative time since the start of the animation.
 
bool animating (duration animation_duration) const noexcept
 
value_type load () const noexcept
 
value_type operator* () const noexcept
 
value_type load (duration animation_duration) const noexcept
 
bool store (value_type const &new_value) noexcept
 
template<typename Callback >
callback_ptr_type subscribe (Callback &&callback) noexcept
 
void subscribe_ptr (callback_ptr_type const &callback) noexcept
 
void unsubscribe (callback_ptr_type const &callback_ptr) noexcept
 

Friends

observable< bool > operator! (observable const &rhs) noexcept
 
bool operator== (observable const &lhs, observable const &rhs) noexcept
 
bool operator== (observable const &lhs, value_type const &rhs) noexcept
 
bool operator== (value_type const &lhs, observable const &rhs) noexcept
 
bool operator!= (observable const &lhs, observable const &rhs) noexcept
 
bool operator!= (observable const &lhs, value_type const &rhs) noexcept
 
bool operator!= (value_type const &lhs, observable const &rhs) noexcept
 
float to_float (observable const &rhs) noexcept
 
float to_float (observable const &rhs, duration animation_duration) noexcept
 
std::string to_string (observable const &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, observable const &rhs) noexcept
 

Member Function Documentation

◆ animation_progress()

template<typename T >
float tt::observable< T >::animation_progress ( duration animation_duration) const
inlinenoexcept

The relative time since the start of the animation.

The relative time since the start of the animation according to the duration of the animation.

Parameters
animation_durationThe duration of the full animation.
Returns
The relative animation progress between 0.0 and 1.0.

◆ duration_since_last_modified()

template<typename T >
duration tt::observable< T >::duration_since_last_modified ( ) const
inlinenoexcept

Duration since the value was last modified.

◆ time_when_last_modified()

template<typename T >
time_point tt::observable< T >::time_when_last_modified ( ) const
inlinenoexcept

Time when the value was modified last.


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