8#include "Containers/Array.h"
13#if !defined(NUM_MULTICAST_DELEGATE_INLINE_ENTRIES) || NUM_MULTICAST_DELEGATE_INLINE_ENTRIES == 0
15#elif NUM_MULTICAST_DELEGATE_INLINE_ENTRIES < 0
16 #error NUM_MULTICAST_DELEGATE_INLINE_ENTRIES must be positive
21#define UE_MULTICAST_DELEGATE_DEFAULT_COMPACTION_THRESHOLD 2
26template<
typename UserPolicy>
31 using typename Super::FReadAccessScope;
32 using Super::GetReadAccessScope;
33 using typename Super::FWriteAccessScope;
34 using Super::GetWriteAccessScope;
63 checkf(
Other.InvocationListLockCount == 0,
TEXT(
"Moving from a multicast delegate while it is mid broadcast"));
72 checkf(InvocationListLockCount == 0,
TEXT(
"Moving to a multicast delegate while it is mid broadcast"));
140 if (ShouldSkipCompactionUnderAutoRTFM() || (InvocationListLockCount > 0))
158 CompactionThreshold = 0;
208#if UE_DELEGATE_CHECK_LIFETIME
246 , InvocationListLockCount(0)
251 template<
typename DelegateInstanceInterfaceType>
280 template<
typename DelegateInstanceInterfaceType,
typename... ParamTypes>
288 LockInvocationList();
307 UnlockInvocationList();
320 template <
typename NewDelegateType>
329 CompactInvocationList(
true);
356 CompactInvocationList();
366 inline bool ShouldSkipCompactionUnderAutoRTFM()
const
372 return AutoRTFM::IsTransactional() || AutoRTFM::IsCommittingOrAborting();
382 if (ShouldSkipCompactionUnderAutoRTFM())
388 if (InvocationListLockCount > 0)
436 return InvocationList;
441 return InvocationList;
445 inline void LockInvocationList( )
const
447 if (ShouldSkipCompactionUnderAutoRTFM())
452 ++InvocationListLockCount;
456 inline void UnlockInvocationList( )
const
458 if (ShouldSkipCompactionUnderAutoRTFM())
463 --InvocationListLockCount;
467 inline int32 GetInvocationListLockCount()
const
469 return InvocationListLockCount;
473 void ClearUnchecked()
477#if UE_DELEGATE_CHECK_LIFETIME
485 CompactInvocationList(
false);
495 mutable int32 InvocationListLockCount = 0;
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define CHECK_DELEGATE_LIFETIME(DelegateInstance)
Definition DelegateBase.h:116
const void * FDelegateUserObjectConst
Definition IDelegateInstance.h:108
FHeapAllocator FMulticastInvocationListAllocatorType
Definition MulticastDelegateBase.h:14
#define UE_MULTICAST_DELEGATE_DEFAULT_COMPACTION_THRESHOLD
Definition MulticastDelegateBase.h:21
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Size
Definition VulkanMemory.cpp:4034
Definition IDelegateInstance.h:14
Definition IDelegateInstance.h:112
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_FORCEINLINE_HINT void RemoveAtSwap(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2185
UE_FORCEINLINE_HINT SizeType Emplace(ArgsType &&... Args)
Definition Array.h:2561
UE_NODEBUG UE_FORCEINLINE_HINT SIZE_T GetAllocatedSize(void) const
Definition Array.h:1059
UE_FORCEINLINE_HINT void Shrink()
Definition Array.h:1278
Definition DelegateAccessHandler.h:30
Definition DelegateBase.h:226
Definition MulticastDelegateBase.h:28
bool IsBoundToObject(FDelegateUserObjectConst InUserObject) const
Definition MulticastDelegateBase.h:110
SIZE_T GetAllocatedSize() const
Definition MulticastDelegateBase.h:195
FDelegateHandle AddDelegateInstance(NewDelegateType &&NewDelegateBaseRef)
Definition MulticastDelegateBase.h:321
TMulticastDelegateBase(TMulticastDelegateBase &&Other)
Definition MulticastDelegateBase.h:42
int32 RemoveAll(FDelegateUserObjectConst InUserObject)
Definition MulticastDelegateBase.h:135
void Clear()
Definition MulticastDelegateBase.h:79
bool RemoveDelegateInstance(FDelegateHandle Handle)
Definition MulticastDelegateBase.h:342
TArray< UnicastDelegateType, FMulticastInvocationListAllocatorType > InvocationListType
Definition MulticastDelegateBase.h:39
TDelegateBase< FNotThreadSafeNotCheckedDelegateMode > UnicastDelegateType
Definition MulticastDelegateBase.h:37
TMulticastDelegateBase & operator=(TMulticastDelegateBase &&Other)
Definition MulticastDelegateBase.h:47
bool IsBound() const
Definition MulticastDelegateBase.h:91
void Broadcast(ParamTypes... Params) const
Definition MulticastDelegateBase.h:281
TMulticastDelegateBase()
Definition MulticastDelegateBase.h:244
void CopyFrom(const TMulticastDelegateBase &Other)
Definition MulticastDelegateBase.h:252
Definition ContainerAllocationPolicies.h:618
Definition ContainerAllocationPolicies.h:894