6#include "Containers/Map.h"
26#include "TypedElementCounter.generated.h"
31template <
typename KeyType>
34 if constexpr (std::is_convertible_v<KeyType, const UObject*>)
36 return std::remove_pointer_t<KeyType>::StaticClass()->GetFName();
82 template <
typename KeyType>
97 template <
typename KeyType>
102 (*CounterCategory)->DecrementCounter(
InKey);
109 template <
typename KeyType>
114 return (*CounterCategory)->GetCounterValue(
InKey);
122 template <
typename KeyType>
127 (*CounterCategory)->ForEachCounterValue<KeyType>(
InCallback);
134 template <
typename KeyType>
139 (*CounterCategory)->ClearCounter(
InKey);
159 class ICounterCategory
162 virtual ~ICounterCategory() =
default;
164 template <
typename KeyType>
170 template <
typename KeyType>
176 template <
typename KeyType>
177 void IncrementCounter(
const KeyType&
InKey)
182 template <
typename KeyType>
183 void DecrementCounter(
const KeyType&
InKey)
188 template <
typename KeyType>
189 void ClearCounter(
const KeyType&
InKey)
205 virtual void ClearCountersImpl() = 0;
208 template <
typename KeyType>
209 class TCounterCategory :
public ICounterCategory
222 const KeyType*
KeyPtr =
static_cast<const KeyType*
>(
InKey);
223 return Counters.FindRef(*
KeyPtr);
244 const KeyType*
KeyPtr =
static_cast<const KeyType*
>(
InKey);
253 const KeyType*
KeyPtr =
static_cast<const KeyType*
>(
InKey);
268 const KeyType*
KeyPtr =
static_cast<const KeyType*
>(
InKey);
272 virtual void ClearCountersImpl()
override
293UINTERFACE(MinimalAPI, meta = (CannotImplementInterfaceInBlueprint))
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
TSizedDefaultAllocator< 32 > FDefaultAllocator
Definition ContainerAllocationPolicies.h:831
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UINTERFACE(...)
Definition ObjectMacros.h:780
FName GetTypedElementCounterKeyName()
Definition TypedElementCounter.h:32
Definition NameTypes.h:617
Definition TypedElementCounter.h:50
int32 FCounterValue
Definition TypedElementCounter.h:52
FCounterValue GetCounterValue(const FName InCategory, const KeyType &InKey) const
Definition TypedElementCounter.h:110
void ForEachCounterValue(const FName InCategory, TFunctionRef< bool(const KeyType &, FCounterValue)> InCallback) const
Definition TypedElementCounter.h:123
void ClearCounter(const FName InCategory, const KeyType &InKey)
Definition TypedElementCounter.h:135
FTypedElementCounter()=default
static TYPEDELEMENTFRAMEWORK_API FName GetElementTypeCategoryName()
Definition TypedElementCounter.cpp:62
FTypedElementCounter & operator=(FTypedElementCounter &&)=default
void DecrementCounter(const FName InCategory, const KeyType &InKey)
Definition TypedElementCounter.h:98
FTypedElementCounter(FTypedElementCounter &&)=default
FTypedElementCounter & operator=(const FTypedElementCounter &)=delete
FTypedElementCounter(const FTypedElementCounter &)=delete
void IncrementCounter(const FName InCategory, const KeyType &InKey)
Definition TypedElementCounter.h:83
TYPEDELEMENTFRAMEWORK_API void ClearCounters()
Definition TypedElementCounter.cpp:57
Definition TypedElementCounter.h:300
virtual void IncrementCountersForElement(const FTypedElementHandle &InElementHandle, FTypedElementCounter &InOutCounter)
Definition TypedElementCounter.h:307
virtual void DecrementCountersForElement(const FTypedElementHandle &InElementHandle, FTypedElementCounter &InOutCounter)
Definition TypedElementCounter.h:312
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition SortedMap.h:20
Definition UniquePtr.h:107
Definition Interface.h:19
Definition TypedElementCounter.h:295
Definition TypedElementRegistry.h:55
Definition NameTypes.h:1639
Definition TypedElementHandle.h:18
static TCHAR const * GetName()
Definition UnrealTypeTraits.h:192
Definition TypedElementHandle.h:271
BaseInterfaceType * InterfacePtr
Definition TypedElementHandle.h:386
void IncrementCountersForElement(FTypedElementCounter &InOutCounter) const
Definition TypedElementCounter.h:318
void DecrementCountersForElement(FTypedElementCounter &InOutCounter) const
Definition TypedElementCounter.h:319
Definition TypedElementHandle.h:396
Definition WeakObjectPtrTemplates.h:25