MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::Observable Namespace Reference

Namespaces

namespace  Detail
 

Data Structures

struct  FStatePolicy
 Flags expressing how TState should handle object comparison and lifespan. More...
 
struct  IState
 Public API and base class for TState which shouldn't concern with policy flags or thread safety. More...
 
struct  IStateTag
 
struct  TChangeData
 This struct holds the circumstances of the data change. It cannot be moved or copied and its lifespan is managed entirely by TState More...
 
struct  TState
 Storage wrapper for any value which state needs to be tracked or their change needs to be observed. By default, TState is not thread-safe unless FStatePolicy::ThreadSafe policy is active in DefaultPolicy. More...
 

Concepts

concept  CState
 Concept constraining given type to a state.
 
concept  CChangeNextOnlyListener
 Concept describing a function which can listen to changes to the current value of a TState only.
 
concept  CChangeNextPreviousListener
 Concept describing a function which can listen to changes to the current and the previous values of a TState.
 
concept  CChangeListener
 Concept describing a function which can be a change listener on a TState.
 

Typedefs

template<typename T >
using IStateRef = TSharedRef<IState<T>>
 Convenience alias for shared reference to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.
 
template<typename T >
using IStatePtr = TSharedPtr<IState<T>>
 Convenience alias for shared pointer to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.
 
template<typename T >
using IStateWeakPtr = TWeakPtr<IState<T>>
 Convenience alias for weak pointer to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.
 
template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using TSharedStateRef = TSharedRef<TState<T, DefaultPolicy>>
 Convenience alias for declaring a state as a shared reference. Use this only as object members.
 
template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using TSharedStatePtr = TSharedPtr<TState<T, DefaultPolicy>>
 Convenience alias for declaring a state as a shared pointer. Use this only as object members.
 
template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using TSharedStateTSRef = TSharedRef<TState<T, DefaultPolicy.With({.ThreadSafe = true})>>
 Convenience alias for declaring a thread-safe state as a shared reference. Use this only as object members.
 
template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using TSharedStateTSPtr = TSharedPtr<TState<T, DefaultPolicy.With({.ThreadSafe = true})>>
 Convenience alias for declaring a thread-safe state as a shared pointer. Use this only as object members.
 
template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using TStateTS = TState<T, DefaultPolicy.With({.ThreadSafe = true})>
 Convenience alias for thread safe states.
 
using FBool = TState<bool>
 Convenience alias for boolean states.
 
using FBoolTS = TStateTS<bool>
 Convenience alias for thread-safe boolean states.
 

Functions

template<typename LeftValue , CWeaklyEqualityComparableWith< LeftValue > RightValue>
bool operator== (IState< LeftValue > const &left, IState< RightValue > const &right)
 
template<typename LeftValue , CPartiallyOrderedWith< LeftValue > RightValue>
bool operator<=> (IState< LeftValue > const &left, IState< RightValue > const &right)
 

Variables

template<typename T >
constexpr FStatePolicy StatePolicyFor
 

Typedef Documentation

◆ FBool

Convenience alias for boolean states.

Definition at line 184 of file Observable.Fwd.h.

◆ FBoolTS

Convenience alias for thread-safe boolean states.

Definition at line 187 of file Observable.Fwd.h.

◆ IStatePtr

template<typename T >
using Mcro::Observable::IStatePtr = TSharedPtr<IState<T>>

Convenience alias for shared pointer to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.

Definition at line 124 of file Observable.Fwd.h.

◆ IStateRef

template<typename T >
using Mcro::Observable::IStateRef = TSharedRef<IState<T>>

Convenience alias for shared reference to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.

Definition at line 116 of file Observable.Fwd.h.

◆ IStateWeakPtr

template<typename T >
using Mcro::Observable::IStateWeakPtr = TWeakPtr<IState<T>>

Convenience alias for weak pointer to a base type of TState. Use this in APIs which may modify or get the value of a state declared elsewhere.

Definition at line 132 of file Observable.Fwd.h.

◆ TSharedStatePtr

template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TSharedStatePtr = TSharedPtr<TState<T, DefaultPolicy>>

Convenience alias for declaring a state as a shared pointer. Use this only as object members.

Definition at line 140 of file Observable.Fwd.h.

◆ TSharedStateRef

template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TSharedStateRef = TSharedRef<TState<T, DefaultPolicy>>

Convenience alias for declaring a state as a shared reference. Use this only as object members.

Definition at line 136 of file Observable.Fwd.h.

◆ TSharedStateTSPtr

template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TSharedStateTSPtr = TSharedPtr<TState<T, DefaultPolicy.With({.ThreadSafe = true})>>

Convenience alias for declaring a thread-safe state as a shared pointer. Use this only as object members.

Definition at line 148 of file Observable.Fwd.h.

◆ TSharedStateTSRef

template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TSharedStateTSRef = TSharedRef<TState<T, DefaultPolicy.With({.ThreadSafe = true})>>

Convenience alias for declaring a thread-safe state as a shared reference. Use this only as object members.

Definition at line 144 of file Observable.Fwd.h.

◆ TStateTS

template<typename T , FStatePolicy DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TStateTS = TState<T, DefaultPolicy.With({.ThreadSafe = true})>

Convenience alias for thread safe states.

Definition at line 181 of file Observable.Fwd.h.

Function Documentation

◆ operator<=>()

template<typename LeftValue , CPartiallyOrderedWith< LeftValue > RightValue>
bool Mcro::Observable::operator<=> ( IState< LeftValue > const & left,
IState< RightValue > const & right )

Definition at line 575 of file Observable.h.

◆ operator==()

template<typename LeftValue , CWeaklyEqualityComparableWith< LeftValue > RightValue>
bool Mcro::Observable::operator== ( IState< LeftValue > const & left,
IState< RightValue > const & right )

Definition at line 569 of file Observable.h.

Variable Documentation

◆ StatePolicyFor

template<typename T >
FStatePolicy Mcro::Observable::StatePolicyFor
inlineconstexpr
Initial value:
=
CClass<T>
? CCoreEqualityComparable<T>
? FStatePolicy {.NotifyOnChangeOnly = true}
: FStatePolicy {.AlwaysNotify = true}
: FStatePolicy {.NotifyOnChangeOnly = true, .StorePrevious = true}
Flags expressing how TState should handle object comparison and lifespan.

Definition at line 94 of file Observable.Fwd.h.