mitteLib
|
#include <observable.hpp>
Public Types | |
using | read_value_type = std::conditional_t<std::is_trivially_copyable_v<T>, T, T const &> |
using | read_observer_fn = std::function<void(read_value_type)> |
using | write_observer_fn = std::function<void(read_value_type, read_value_type)> |
Public Member Functions | |
observable () | |
observable (T t) | |
operator read_value_type () const | |
observable & | operator= (T t) |
observe< T > | do_observe (read_observer_fn read_fn, write_observer_fn write_fn) |
observable_ref< T > | ref () |
observable_cref< T > | cref () const |
Private Member Functions | |
std::size_t | append_observer (std::pair< read_observer_fn, write_observer_fn > observers) |
void | delete_observer (std::size_t idx) |
Private Attributes | |
T | _value |
std::recursive_mutex | _lock |
std::vector< std::pair< read_observer_fn, write_observer_fn > > | _observers |
Friends | |
class | observe< T > |
using mlab::observable< T >::read_observer_fn = std::function<void(read_value_type)> |
using mlab::observable< T >::read_value_type = std::conditional_t<std::is_trivially_copyable_v<T>, T, T const &> |
using mlab::observable< T >::write_observer_fn = std::function<void(read_value_type, read_value_type)> |
|
inline |
|
inlineexplicit |
|
nodiscardprivate |
|
nodiscard |
|
private |
|
nodiscard |
|
inline |
|
inline |
|
nodiscard |
|
friend |
|
mutableprivate |
|
private |
|
private |