Weaponry Assembly System
WAS
Loading...
Searching...
No Matches
TPropertyOverrider< T > Struct Template Reference

Templated property override with lazy-evaluated arithmetic operations. More...

#include <PropertyOverrider.h>

+ Collaboration diagram for TPropertyOverrider< T >:

Classes

struct  TOperator
 

Public Member Functions

void ClearDirty () const
 
FORCEINLINE EOperator GetOperatorExpression () const
 
FORCEINLINE TConstSmall GetOperatorValue () const
 
GetOriginalValue () const
 
TConstSmall GetValue () const
 
bool IsDirty () const
 
void MarkDirty () const
 
 operator TConstSmall () const
 
TConstSmall operator%= (TConstSmall InValue)
 
TConstSmall operator* ()
 
TConstSmall operator*= (TConstSmall InValue)
 
TConstSmall operator+= (TConstSmall InValue)
 
TConstSmall operator-= (TConstSmall InValue)
 
TConstSmall operator/= (TConstSmall InValue)
 
TConstSmall operator= (TConstSmall InValue)
 
void SetOperatorExpression (EOperator NewOperatorExpression)
 

Protected Types

using TConstSmall
 
using TSmall
 

Static Protected Member Functions

static constexpr uint8 FirstBitActive ()
 
static constexpr uint8 FirstBitInactive ()
 
static constexpr uint8 GetFirstBitOffset ()
 

Protected Attributes

BaseValue = T()
 
CachedValue = T()
 
TOperator OperatorExpression = EOperator::Ignore
 
OperatorValue = 1
 

Detailed Description

template<typename T>
struct TPropertyOverrider< T >

Templated property override with lazy-evaluated arithmetic operations.

Stores a base value and applies an operator (Add, Subtract, Multiply, Divide, Modulo, Power, Set) lazily. The result is cached and only recalculated when the base value, operator, or operator value changes. This allows modifying properties without conflicting with the weaponry assembly system.

Member Typedef Documentation

◆ TConstSmall

template<typename T >
using TPropertyOverrider< T >::TConstSmall
protected
Initial value:
std::conditional_t<sizeof(T) <= 2*sizeof(void*) && std::is_trivially_copy_constructible_v<T>,
T,
const T&
>

◆ TSmall

template<typename T >
using TPropertyOverrider< T >::TSmall
protected
Initial value:
std::conditional_t<sizeof(T) <= 2*sizeof(void*) && std::is_trivially_copy_constructible_v<T>,
T,
T&
>

Member Function Documentation

◆ ClearDirty()

template<typename T >
void TPropertyOverrider< T >::ClearDirty ( ) const
inline

Recalculate cached value from operator expression.

◆ FirstBitActive()

template<typename T >
static constexpr uint8 TPropertyOverrider< T >::FirstBitActive ( )
inlinestaticconstexprprotected

Bit mask with dirty flag set.

◆ FirstBitInactive()

template<typename T >
static constexpr uint8 TPropertyOverrider< T >::FirstBitInactive ( )
inlinestaticconstexprprotected

Bit mask with all bits except dirty flag.

◆ GetFirstBitOffset()

template<typename T >
static constexpr uint8 TPropertyOverrider< T >::GetFirstBitOffset ( )
inlinestaticconstexprprotected

Highest bit used as dirty flag in TOperator.

◆ GetOperatorExpression()

template<typename T >
FORCEINLINE EOperator TPropertyOverrider< T >::GetOperatorExpression ( ) const
inline

Returns current operator type.

◆ GetOperatorValue()

template<typename T >
FORCEINLINE TConstSmall TPropertyOverrider< T >::GetOperatorValue ( ) const
inline

Returns the operand for the operator.

◆ GetOriginalValue()

template<typename T >
T TPropertyOverrider< T >::GetOriginalValue ( ) const
inline

Returns the base value without operator applied.

◆ GetValue()

template<typename T >
TConstSmall TPropertyOverrider< T >::GetValue ( ) const
inline

Returns computed result (base value with operator applied).

◆ IsDirty()

template<typename T >
bool TPropertyOverrider< T >::IsDirty ( ) const
inline

Returns true if cached value needs recalculation.

◆ MarkDirty()

template<typename T >
void TPropertyOverrider< T >::MarkDirty ( ) const
inline

Mark cached value as stale requiring recalculation.

◆ operator TConstSmall()

template<typename T >
TPropertyOverrider< T >::operator TConstSmall ( ) const
inline

◆ operator%=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator%= ( TConstSmall InValue)
inline

◆ operator*()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator* ( )
inline

◆ operator*=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator*= ( TConstSmall InValue)
inline

◆ operator+=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator+= ( TConstSmall InValue)
inline

◆ operator-=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator-= ( TConstSmall InValue)
inline

◆ operator/=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator/= ( TConstSmall InValue)
inline

◆ operator=()

template<typename T >
TConstSmall TPropertyOverrider< T >::operator= ( TConstSmall InValue)
inline

◆ SetOperatorExpression()

template<typename T >
void TPropertyOverrider< T >::SetOperatorExpression ( EOperator NewOperatorExpression)
inline

Sets operator and marks cached value as stale.

Member Data Documentation

◆ BaseValue

template<typename T >
T TPropertyOverrider< T >::BaseValue = T()
protected

The original unmodified value.

◆ CachedValue

template<typename T >
T TPropertyOverrider< T >::CachedValue = T()
mutableprotected

Cached result of applying the operator.

◆ OperatorExpression

template<typename T >
TOperator TPropertyOverrider< T >::OperatorExpression = EOperator::Ignore
protected

Current operator with dirty flag in highest bit.

◆ OperatorValue

template<typename T >
T TPropertyOverrider< T >::OperatorValue = 1
protected

The operand for the operator expression.