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

Data Structures

struct  IState
 
struct  IStateTag
 
struct  TChangeData
 
struct  TState
 

Concepts

concept  CState
 
concept  CChangeListener
 
concept  CChangeNextOnlyListener
 
concept  CChangeNextPreviousListener
 

Typedefs

template<typename T >
using TStateRef = TSharedRef<IState<T>>
 
template<typename T >
using TStatePtr = TSharedPtr<IState<T>>
 
template<typename T >
using TStateWeakPtr = TWeakPtr<IState<T>>
 
template<typename T , int32 DefaultPolicy = StatePolicyFor<T>>
using TDeclareStateRef = TSharedRef<TState<T, DefaultPolicy>>
 
template<typename T , int32 DefaultPolicy = StatePolicyFor<T>>
using TDeclareStatePtr = TSharedPtr<TState<T, DefaultPolicy>>
 
template<typename T , int32 DefaultPolicy = StatePolicyFor<T> | ThreadSafeState>
using TStateTS = TState<T, DefaultPolicy>
 
using FBool = TState<bool>
 
using FBoolTS = TStateTS<bool>
 

Enumerations

enum  EStatePolicy { NotifyOnChangeOnly = 0 , AlwaysNotify = 1 << 0 , StorePrevious = 1 << 1 , ThreadSafeState = 1 << 2 }
 

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 int32 StatePolicyFor
 
concept TFunction_ArgDecay< Function, 0 >
 

Typedef Documentation

◆ FBool

Convenience alias for boolean states

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

◆ FBoolTS

Convenience alias for thread-safe boolean states

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

◆ TDeclareStatePtr

template<typename T , int32 DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TDeclareStatePtr = TSharedPtr<TState<T, DefaultPolicy>>

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

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

◆ TDeclareStateRef

template<typename T , int32 DefaultPolicy = StatePolicyFor<T>>
using Mcro::Observable::TDeclareStateRef = TSharedRef<TState<T, DefaultPolicy>>

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

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

◆ TStatePtr

template<typename T >
using Mcro::Observable::TStatePtr = 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 80 of file Observable.Fwd.h.

◆ TStateRef

template<typename T >
using Mcro::Observable::TStateRef = 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 73 of file Observable.Fwd.h.

◆ TStateTS

template<typename T , int32 DefaultPolicy = StatePolicyFor<T> | ThreadSafeState>
using Mcro::Observable::TStateTS = TState<T, DefaultPolicy>

Convenience alias for thread safe states

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

◆ TStateWeakPtr

template<typename T >
using Mcro::Observable::TStateWeakPtr = 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 87 of file Observable.Fwd.h.

Enumeration Type Documentation

◆ EStatePolicy

Flags expressing how TState should handle object comparison and lifespan

Enumerator
NotifyOnChangeOnly 

When the object inside TState is != comparable TState wull only emit change events when the submitted value differs from the existing one.

AlwaysNotify 1 << 0 

Always emit change notification when a value is set on TState and don't attempt to compare them

StorePrevious 1 << 1 

Always emit change notification when a value is set on TState and don't attempt to compare them

ThreadSafeState 1 << 2 

Enable mutexes during modifications, notifications and expose a public critical section for users of the state.

Definition at line 28 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 394 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 388 of file Observable.h.

Variable Documentation

◆ StatePolicyFor

template<typename T >
int32 Mcro::Observable::StatePolicyFor
inlineconstexpr
Initial value:

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

◆ TFunction_ArgDecay< Function, 0 >

concept Mcro::Observable::TFunction_ArgDecay< Function, 0 >

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