20#include "CoreMinimal.h"
96 ? CCoreEqualityComparable<T>
98 : FStatePolicy {.AlwaysNotify =
true}
99 : FStatePolicy {.NotifyOnChangeOnly =
true, .StorePrevious =
true};
101 template <
typename T>
104 template <
typename T>
107 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
115 template <
typename T>
123 template <
typename T>
131 template <
typename T>
135 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
139 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
143 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
147 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
151 template <
typename T>
152 concept CState = CDerivedFrom<T, IStateTag>;
156 template <
typename Function,
typename T>
158 && TFunction_ArgCount<Function> > 0
159 && CConvertibleTo<T, TFunction_ArgDecay<Function, 0>>
165 template <
typename Function,
typename T>
169 template <
typename Function,
typename T>
176 template <
typename Function,
typename T>
180 template <
typename T, FStatePolicy DefaultPolicy = StatePolicyFor<T>>
Concept describing a function which can be a change listener on a TState.
Concept describing a function which can listen to changes to the current value of a TState only.
Concept describing a function which can listen to changes to the current and the previous values of a...
Concept constraining given type to a state.
constexpr size_t TFunction_ArgCount
Shorthand for getting a function argument count.
typename TFunctionTraits< std::decay_t< T > >::template ArgDecay< I > TFunction_ArgDecay
Shorthand for getting a decayed type of a function argument at given position I.
TSharedRef< TState< T, DefaultPolicy > > TSharedStateRef
Convenience alias for declaring a state as a shared reference. Use this only as object members.
TSharedPtr< IState< T > > IStatePtr
Convenience alias for shared pointer to a base type of TState. Use this in APIs which may modify or g...
TSharedRef< IState< T > > IStateRef
Convenience alias for shared reference to a base type of TState. Use this in APIs which may modify or...
TSharedPtr< TState< T, DefaultPolicy > > TSharedStatePtr
Convenience alias for declaring a state as a shared pointer. Use this only as object members.
TSharedPtr< TState< T, DefaultPolicy.With({.ThreadSafe=true})> > TSharedStateTSPtr
Convenience alias for declaring a thread-safe state as a shared pointer. Use this only as object memb...
TSharedRef< TState< T, DefaultPolicy.With({.ThreadSafe=true})> > TSharedStateTSRef
Convenience alias for declaring a thread-safe state as a shared reference. Use this only as object me...
TWeakPtr< IState< T > > IStateWeakPtr
Convenience alias for weak pointer to a base type of TState. Use this in APIs which may modify or get...
constexpr FStatePolicy StatePolicyFor
Flags expressing how TState should handle object comparison and lifespan.
bool StorePrevious
Store previous value as well. If the value is equality comparable store only when it's changed.
bool AlwaysStorePrevious
If the state value is equality comparable, store the previous value even when that's equal to the new...
bool NotifyOnChangeOnly
When the object inside TState is != comparable TState wull only emit change events when the submitted...
FORCEINLINE friend constexpr bool operator!=(FStatePolicy const &lhs, FStatePolicy const &rhs)
FORCEINLINE friend constexpr bool operator==(FStatePolicy const &lhs, FStatePolicy const &rhs)
FORCEINLINE constexpr bool IsDefault() const
Is this instance equivalent to a default constructed one.
FORCEINLINE constexpr FStatePolicy With(FStatePolicy const &other) const
Merge two policy flags.
bool AlwaysNotify
Always emit change notification when a value is set on TState and don't attempt to compare them.
bool ThreadSafe
Enable mutexes during modifications, notifications and expose a public read-lock for users of the sta...
Storage wrapper for any value which state needs to be tracked or their change needs to be observed....