HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields | Friends
hi::v1::observer< T >::proxy_type Class Reference

#include <hikogui/observer/observer_intf.hpp>

Public Types

using reference = value_type &
 
using const_reference = value_type const &
 
using pointer = value_type *
 
using const_pointer = value_type const *
 

Public Member Functions

 ~proxy_type () noexcept
 Commits and destruct the proxy object.
 
 proxy_type (proxy_type const &)=delete
 
proxy_typeoperator= (proxy_type const &)=delete
 
 proxy_type (proxy_type &&other) noexcept
 
proxy_typeoperator= (proxy_type &&other) noexcept
 
 proxy_type (observer *observer, value_type *ptr) noexcept
 Create a proxy object.
 
 proxy_type () noexcept
 Create a proxy object.
 
reference operator* () noexcept
 Dereference the value.
 
const_reference operator* () const noexcept
 Dereference the value.
 
pointer operator-> () noexcept
 Pointer dereference the value.
 
const_pointer operator-> () const noexcept
 Pointer dereference the value.
 
pointer operator& () noexcept
 Pointer dereference the value.
 
const_pointer operator& () const noexcept
 Pointer dereference the value.
 
 X (++) X(--) X(++) X(--) X(+
 
void start_write () noexcept
 

Data Fields

value_type * _ptr
 
std::optional< value_type > _original_value
 

Friends

class observer
 

Detailed Description

template<typename T>
class hi::v1::observer< T >::proxy_type

A proxy object of the observer.

The proxy is a RAII object that makes sure that listeners will get notified if the value was modified.

Constructor & Destructor Documentation

◆ ~proxy_type()

template<typename T >
hi::v1::observer< T >::proxy_type::~proxy_type ( )
inlinenoexcept

Commits and destruct the proxy object.

If commit() or abort() are called or the proxy object is empty then the destructor does not commit the changes.

◆ proxy_type() [1/2]

template<typename T >
hi::v1::observer< T >::proxy_type::proxy_type ( observer * observer,
value_type * ptr )
inlinenoexcept

Create a proxy object.

Parameters
observera pointer to the observer.
ptra pointer to the sub-object of the shared_state that the observer is pointing to.

◆ proxy_type() [2/2]

template<typename T >
hi::v1::observer< T >::proxy_type::proxy_type ( )
inlinenoexcept

Create a proxy object.

Parameters
observera pointer to the observer.
ptra pointer to the sub-object of the shared_state that the observer is pointing to.

Member Function Documentation

◆ operator&() [1/2]

template<typename T >
const_pointer hi::v1::observer< T >::proxy_type::operator& ( ) const
inlinenoexcept

Pointer dereference the value.

This function allows reads and modification to the value, including calling member functions on the value.

Note
It is undefined behavior to call this function after calling commit() or abort()

◆ operator&() [2/2]

template<typename T >
pointer hi::v1::observer< T >::proxy_type::operator& ( )
inlinenoexcept

Pointer dereference the value.

This function allows reads and modification to the value, including calling member functions on the value.

Note
It is undefined behavior to call this function after calling commit() or abort()

◆ operator*() [1/2]

template<typename T >
const_reference hi::v1::observer< T >::proxy_type::operator* ( ) const
inlinenoexcept

Dereference the value.

This function allows reads and modification to the value

Note
It is undefined behavior to call this function after calling commit() or abort()

◆ operator*() [2/2]

template<typename T >
reference hi::v1::observer< T >::proxy_type::operator* ( )
inlinenoexcept

Dereference the value.

This function allows reads and modification to the value

Note
It is undefined behavior to call this function after calling commit() or abort()

◆ operator->() [1/2]

template<typename T >
const_pointer hi::v1::observer< T >::proxy_type::operator-> ( ) const
inlinenoexcept

Pointer dereference the value.

This function allows reads and modification to the value, including calling member functions on the value.

Note
It is undefined behavior to call this function after calling commit() or abort()

◆ operator->() [2/2]

template<typename T >
pointer hi::v1::observer< T >::proxy_type::operator-> ( )
inlinenoexcept

Pointer dereference the value.

This function allows reads and modification to the value, including calling member functions on the value.

Note
It is undefined behavior to call this function after calling commit() or abort()

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