UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DelegateSignatureImpl.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3// Only designed to be included directly by Delegate.h
4#if !defined( __Delegate_h__ ) || !defined( FUNC_INCLUDING_INLINE_IMPL )
5 #error "This inline header must only be included by Delegate.h"
6#endif
7
8#pragma once
9
10// HEADER_UNIT_SKIP - Not included directly
11
12#include "CoreTypes.h"
14#include "UObject/NameTypes.h"
18#include "Templates/Identity.h"
21#include <type_traits>
22
23class FDelegateHandle;
25struct FWeakObjectPtr;
26template <typename FuncType, typename UserPolicy> struct IBaseDelegateInstance;
27template <typename T> struct TObjectPtr;
28
29template <typename T>
30T* ToRawPtr(const TObjectPtr<T>& Ptr);
31
32template <typename To, typename From>
34
35template<typename UserPolicy> class TMulticastDelegateBase;
36
66template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
68
69template <typename InRetValType, typename... ParamTypes, typename UserPolicy>
70class TDelegateRegistration<InRetValType(ParamTypes...), UserPolicy> : public UserPolicy::FDelegateExtras
71{
72private:
73 using Super = typename UserPolicy::FDelegateExtras;
74
75protected:
76 using FuncType = InRetValType (ParamTypes...);
78
79private:
80 static_assert(std::is_convertible_v<typename UserPolicy::FDelegateInstanceExtras*, IDelegateInstance*>, "UserPolicy::FDelegateInstanceExtras should publicly inherit IDelegateInstance");
81 static_assert(std::is_convertible_v<typename UserPolicy::FMulticastDelegateExtras*, TMulticastDelegateBase<UserPolicy>*>, "UserPolicy::FMulticastDelegateExtras should publicly inherit TMulticastDelegateBase<UserPolicy>");
82
83 template <typename, typename>
84 friend class TDelegate;
85
86 template <typename, typename>
88
89 template <typename>
91
92 template <typename, typename>
93 friend class TMulticastDelegate;
94
95 template <typename, typename>
97
98public:
101 using TFuncType = InRetValType(ParamTypes...);
102
103protected:
110
111public:
115 template <typename... VarTypes>
116 inline void BindStatic(typename TBaseStaticDelegateInstance<FuncType, UserPolicy, std::decay_t<VarTypes>...>::FFuncPtr InFunc, VarTypes&&... Vars)
117 {
118 new (TWriteLockedDelegateAllocation{*this}) TBaseStaticDelegateInstance<FuncType, UserPolicy, std::decay_t<VarTypes>...>(InFunc, Forward<VarTypes>(Vars)...);
119 }
120
125 template<typename FunctorType, typename... VarTypes>
126 inline void BindLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
127 {
128 new (TWriteLockedDelegateAllocation{*this}) TBaseFunctorDelegateInstance<FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
129 }
130
135 template<typename UserClass, ESPMode Mode, typename FunctorType, typename... VarTypes>
137 {
138 new (TWriteLockedDelegateAllocation{*this}) TBaseSPLambdaDelegateInstance<Mode, FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(TWeakPtr<const void>(InUserObjectRef), Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
139 }
140 template <typename UserClass, typename FunctorType, typename... VarTypes>
141 inline void BindSPLambda(const UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
142 {
143 new (TWriteLockedDelegateAllocation{*this}) TBaseSPLambdaDelegateInstance<decltype(InUserObject->AsShared())::Mode, FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(TWeakPtr<const void>(InUserObject->AsWeak()), Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
144 }
145
150 template<typename FunctorType, typename... VarTypes>
151 inline void BindWeakLambda(const UObject* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
152 {
153 new (TWriteLockedDelegateAllocation{*this}) TWeakBaseFunctorDelegateInstance<FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(InUserObject, Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
154 }
155
162 template <typename UserClass, typename... VarTypes>
163 inline void BindRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
164 {
165 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
166
167 new (TWriteLockedDelegateAllocation{*this}) TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
168 }
169 template <typename UserClass, typename... VarTypes>
170 inline void BindRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
171 {
172 new (TWriteLockedDelegateAllocation{*this}) TBaseRawMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
173 }
174
178 template <typename UserClass, ESPMode Mode, typename... VarTypes>
179 inline void BindSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
180 {
181 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
182
183 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<false, UserClass, Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
184 }
185 template <typename UserClass, ESPMode Mode, typename... VarTypes>
186 inline void BindSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
187 {
188 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<true, const UserClass, Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
189 }
190
197 template <typename UserClass, typename... VarTypes>
198 inline void BindSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
199 {
200 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
201
202 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<false, UserClass, decltype(InUserObject->AsShared())::Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
203 }
204 template <typename UserClass, typename... VarTypes>
205 inline void BindSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
206 {
207 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<true, const UserClass, decltype(InUserObject->AsShared())::Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<const UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
208 }
209
218 template <typename UserClass, typename... VarTypes>
219 inline void BindThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
220 {
221 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
222
223 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
224 }
225 template <typename UserClass, typename... VarTypes>
226 inline void BindThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
227 {
228 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<true, const UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
229 }
230
239 template <typename UserClass, typename... VarTypes>
240 inline void BindThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
241 {
242 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
243
244 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
245 }
246 template <typename UserClass, typename... VarTypes>
247 inline void BindThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
248 {
249 new (TWriteLockedDelegateAllocation{*this}) TBaseSPMethodDelegateInstance<true, const UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<const UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
250 }
251
258 template <typename UObjectTemplate, typename... VarTypes>
263 template <typename UObjectTemplate, typename... VarTypes>
268
275 template <typename UserClass, typename... VarTypes>
276 inline void BindUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
277 {
278 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
279
280 new (TWriteLockedDelegateAllocation{*this}) TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
281 }
282 template <typename UserClass, typename... VarTypes>
283 inline void BindUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
284 {
285 new (TWriteLockedDelegateAllocation{*this}) TBaseUObjectMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
286 }
287 template <typename UserClass, typename... VarTypes>
288 inline void BindUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
289 {
290 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
291
292 new (TWriteLockedDelegateAllocation{*this}) TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(ToRawPtr(InUserObject), InFunc, Forward<VarTypes>(Vars)...);
293 }
294 template <typename UserClass, typename... VarTypes>
295 inline void BindUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
296 {
297 new (TWriteLockedDelegateAllocation{*this}) TBaseUObjectMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(ToRawPtr(InUserObject), InFunc, Forward<VarTypes>(Vars)...);
298 }
299
300 // Executing via a delegate registration reference is not allowed
301 RetValType Execute (ParamTypes... Params) const = delete;
302 bool ExecuteIfBound(ParamTypes... Params) const = delete;
303};
304
308template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
310{
311 static_assert(sizeof(UserPolicy) == 0, "Expected a function signature for the delegate template parameter");
312};
313
314template <typename InRetValType, typename... ParamTypes, typename UserPolicy>
315class TDelegate<InRetValType(ParamTypes...), UserPolicy> : public TDelegateRegistration<InRetValType(ParamTypes...), UserPolicy>
316{
317private:
318 using Super = TDelegateRegistration<InRetValType(ParamTypes...), UserPolicy>;
319 using DelegateInstanceInterfaceType = typename Super::DelegateInstanceInterfaceType;
320 using FuncType = typename Super::FuncType;
321
322 // Make sure FDelegateBase's protected functions are not accidentally exposed through the TDelegate API
323 using typename Super::FReadAccessScope;
324 using Super::GetReadAccessScope;
325 using typename Super::FWriteAccessScope;
326 using Super::GetWriteAccessScope;
327
328public:
330
333 using TFuncType = InRetValType(ParamTypes...);
334
335 /* Helper typedefs for getting a member function pointer type for the delegate with a given payload */
336 template <typename... VarTypes> using TFuncPtr = RetValType(*)(ParamTypes..., VarTypes...);
337 template <typename UserClass, typename... VarTypes> using TMethodPtr = typename TMemFunPtrType<false, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type;
338 template <typename UserClass, typename... VarTypes> using TConstMethodPtr = typename TMemFunPtrType<true, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type;
339
340 TDelegate() = default;
341
343 {
344 }
345
346 inline TDelegate(const TDelegate& Other)
347 {
348 CopyFrom(Other);
349 }
350
352 {
353 CopyFrom(Other);
354 return *this;
355 }
356
359 ~TDelegate() = default;
360
364 template <typename... VarTypes>
365 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateStatic(TIdentity_T<RetValType (*)(ParamTypes..., std::decay_t<VarTypes>...)> InFunc, VarTypes&&... Vars)
366 {
367 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
368 new (TWriteLockedDelegateAllocation{Result}) TBaseStaticDelegateInstance<FuncType, UserPolicy, std::decay_t<VarTypes>...>(InFunc, Forward<VarTypes>(Vars)...);
369 return Result;
370 }
371
376 template<typename FunctorType, typename... VarTypes>
377 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
378 {
379 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
380 new (TWriteLockedDelegateAllocation{Result}) TBaseFunctorDelegateInstance<FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
381 return Result;
382 }
383
388 template<typename UserClass, ESPMode Mode, typename FunctorType, typename... VarTypes>
389 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSPLambda(const TSharedRef<UserClass, Mode>& InUserObjectRef, FunctorType&& InFunctor, VarTypes&&... Vars)
390 {
391 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
392 new (TWriteLockedDelegateAllocation{Result}) TBaseSPLambdaDelegateInstance<Mode, FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(InUserObjectRef, Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
393 return Result;
394 }
395 template <typename UserClass, typename FunctorType, typename... VarTypes>
396 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSPLambda(UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
397 {
398 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
399 new (TWriteLockedDelegateAllocation{Result}) TBaseSPLambdaDelegateInstance<decltype(InUserObject->AsWeak())::Mode, FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(TWeakPtr<const void>(InUserObject->AsWeak()), Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
400 return Result;
401 }
402
407 template<typename FunctorType, typename... VarTypes>
408 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateWeakLambda(const UObject* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
409 {
410 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
411 new (TWriteLockedDelegateAllocation{Result}) TWeakBaseFunctorDelegateInstance<FuncType, UserPolicy, std::remove_reference_t<FunctorType>, std::decay_t<VarTypes>...>(InUserObject, Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...);
412 return Result;
413 }
414
421 template <typename UserClass, typename... VarTypes>
422 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
423 {
424 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
425
426 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
427 new (TWriteLockedDelegateAllocation{Result}) TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
428 return Result;
429 }
430 template <typename UserClass, typename... VarTypes>
431 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
432 {
433 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
434 new (TWriteLockedDelegateAllocation{Result}) TBaseRawMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
435 return Result;
436 }
437
444 template <typename UserClass, ESPMode Mode, typename... VarTypes>
445 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
446 {
447 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
448
449 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
450 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<false, UserClass, Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
451 return Result;
452 }
453 template <typename UserClass, ESPMode Mode, typename... VarTypes>
454 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
455 {
456 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
457 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<true, const UserClass, Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
458 return Result;
459 }
460
467 template <typename UserClass, typename... VarTypes>
468 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
469 {
470 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
471
472 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
473 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<false, UserClass, decltype(InUserObject->AsShared())::Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
474 return Result;
475 }
476 template <typename UserClass, typename... VarTypes>
477 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
478 {
479 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
480 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<true, const UserClass, decltype(InUserObject->AsShared())::Mode, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<const UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
481 return Result;
482 }
483
492 template <typename UserClass, typename... VarTypes>
493 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
494 {
495 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
496
497 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
498 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
499 return Result;
500 }
501 template <typename UserClass, typename... VarTypes>
502 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
503 {
504 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
505 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<true, const UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...);
506 return Result;
507 }
508
517 template <typename UserClass, typename... VarTypes>
518 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
519 {
520 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
521
522 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
523 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
524 return Result;
525 }
526 template <typename UserClass, typename... VarTypes>
527 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
528 {
529 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
530 new (TWriteLockedDelegateAllocation{Result}) TBaseSPMethodDelegateInstance<true, const UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, std::decay_t<VarTypes>...>(StaticCastSharedRef<const UserClass>(InUserObject->AsShared()), InFunc, Forward<VarTypes>(Vars)...);
531 return Result;
532 }
533
540 template <typename UObjectTemplate, typename... VarTypes>
541 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUFunction(UObjectTemplate* InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
542 {
543 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
544 new (TWriteLockedDelegateAllocation{Result}) TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunctionName, Forward<VarTypes>(Vars)...);
545 return Result;
546 }
547 template <typename UObjectTemplate, typename... VarTypes>
549 {
550 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
552 return Result;
553 }
554
561 template <typename UserClass, typename... VarTypes>
562 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
563 {
564 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
565
566 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
567 new (TWriteLockedDelegateAllocation{Result}) TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
568 return Result;
569 }
570 template <typename UserClass, typename... VarTypes>
571 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
572 {
573 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
574 new (TWriteLockedDelegateAllocation{Result}) TBaseUObjectMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(InUserObject, InFunc, Forward<VarTypes>(Vars)...);
575 return Result;
576 }
577 template <typename UserClass, typename... VarTypes>
578 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
579 {
580 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
581
582 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
583 new (TWriteLockedDelegateAllocation{Result}) TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(ToRawPtr(InUserObject), InFunc, Forward<VarTypes>(Vars)...);
584 return Result;
585 }
586 template <typename UserClass, typename... VarTypes>
587 [[nodiscard]] inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
588 {
589 TDelegate<RetValType(ParamTypes...), UserPolicy> Result;
590 new (TWriteLockedDelegateAllocation{Result}) TBaseUObjectMethodDelegateInstance<true, const UserClass, FuncType, UserPolicy, std::decay_t<VarTypes>...>(ToRawPtr(InUserObject), InFunc, Forward<VarTypes>(Vars)...);
591 return Result;
592 }
593
594public:
603 inline RetValType Execute(ParamTypes... Params) const
604 {
605 FReadAccessScope ReadScope = GetReadAccessScope();
606
607 const DelegateInstanceInterfaceType* LocalDelegateInstance = GetDelegateInstanceProtected();
609
610 // If this assert goes off, Execute() was called before a function was bound to the delegate.
611 // Consider using ExecuteIfBound() instead.
613
614 return LocalDelegateInstance->Execute(Forward<ParamTypes>(Params)...);
615 }
616
622 // NOTE: Currently only delegates with no return value support ExecuteIfBound()
623 inline bool ExecuteIfBound(ParamTypes... Params) const
624 requires (std::is_void_v<RetValType>)
625 {
626 FReadAccessScope ReadScope = GetReadAccessScope();
627
628 if (const DelegateInstanceInterfaceType* Ptr = GetDelegateInstanceProtected())
629 {
631 return Ptr->ExecuteIfSafe(Forward<ParamTypes>(Params)...);
632 }
633
634 return false;
635 }
636
637protected:
641 UE_FORCEINLINE_HINT DelegateInstanceInterfaceType* GetDelegateInstanceProtected()
642 {
643 return static_cast<DelegateInstanceInterfaceType*>(Super::GetDelegateInstanceProtected());
644 }
645 UE_FORCEINLINE_HINT const DelegateInstanceInterfaceType* GetDelegateInstanceProtected() const
646 {
647 return static_cast<const DelegateInstanceInterfaceType*>(Super::GetDelegateInstanceProtected());
648 }
649
650private:
651 template<typename OtherUserPolicy>
652 void CopyFrom(const TDelegate<FuncType, OtherUserPolicy>& Other)
653 {
654 if ((void*)&Other == (void*)this)
655 {
656 return;
657 }
658
659 // to not hold both delegates locked, make a local copy of `Other` and then move it into this instance
661
662 {
664
665 // this down-cast is OK! allows for managing invocation list in the base class without requiring virtual functions
667 const OtherDelegateInstanceInterfaceType* OtherDelegateInstance = Other.GetDelegateInstanceProtected();
668
669 if (OtherDelegateInstance != nullptr)
670 {
671 OtherDelegateInstance->CreateCopy(LocalCopy);
672 }
673 }
674
675 *this = MoveTemp(LocalCopy);
676 }
677
678 // copying from delegates with different user policy
679 template<typename OtherUserPolicy>
681 {
682 CopyFrom(Other);
683 }
684};
685
687
688template <typename DelegateSignature>
690
691template <typename DelegateSignature>
693
695
724template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
726
727template <typename... ParamTypes, typename UserPolicy>
728class TMulticastDelegateRegistration<void(ParamTypes...), UserPolicy> : public UserPolicy::FMulticastDelegateExtras
729{
730protected:
731 using Super = typename UserPolicy::FMulticastDelegateExtras;
732 using DelegateInstanceInterfaceType = IBaseDelegateInstance<void (ParamTypes...), UserPolicy>;
733
734private:
735 using InvocationListType = typename Super::InvocationListType;
736
737public:
739 using FDelegate = TDelegate<void(ParamTypes...), UserPolicy>;
740
741public:
742 // Make sure TMulticastDelegateBase's public functions are publicly exposed through the TMulticastDelegateRegistration API
743 using Super::Clear;
744 using Super::IsBound;
745 using Super::IsBoundToObject;
746 using Super::RemoveAll;
747 using Super::GetAllocatedSize;
748
749private:
750 // Make sure TMulticastDelegateBase's protected functions are not accidentally exposed through the TMulticastDelegateRegistration API
751 using Super::AddDelegateInstance;
752 using Super::RemoveDelegateInstance;
753
754protected:
761
762public:
763
770 {
771 return Super::AddDelegateInstance(MoveTemp(InNewDelegate));
772 }
773
780 {
781 return Super::AddDelegateInstance(CopyTemp(InNewDelegate));
782 }
783
789 template <typename... VarTypes>
790 inline FDelegateHandle AddStatic(typename TBaseStaticDelegateInstance<void (ParamTypes...), UserPolicy, std::decay_t<VarTypes>...>::FFuncPtr InFunc, VarTypes&&... Vars)
791 {
792 return Super::AddDelegateInstance(FDelegate::CreateStatic(InFunc, Forward<VarTypes>(Vars)...));
793 }
794
801 template<typename FunctorType, typename... VarTypes>
802 inline FDelegateHandle AddLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
803 {
804 return Super::AddDelegateInstance(FDelegate::CreateLambda(Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...));
805 }
806
814 template <typename UserClass, typename FunctorType, typename... VarTypes>
815 inline FDelegateHandle AddSPLambda(const UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
816 {
817 return Super::AddDelegateInstance(FDelegate::CreateSPLambda(InUserObject, Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...));
818 }
819
827 template<typename UserClass, typename FunctorType, typename... VarTypes>
828 inline FDelegateHandle AddWeakLambda(UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
829 {
830 return Super::AddDelegateInstance(FDelegate::CreateWeakLambda(InUserObject, Forward<FunctorType>(InFunctor), Forward<VarTypes>(Vars)...));
831 }
832
842 template <typename UserClass, typename... VarTypes>
843 inline FDelegateHandle AddRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
844 {
845 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
846
847 return Super::AddDelegateInstance(FDelegate::CreateRaw(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
848 }
849 template <typename UserClass, typename... VarTypes>
850 inline FDelegateHandle AddRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
851 {
852 return Super::AddDelegateInstance(FDelegate::CreateRaw(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
853 }
854
863 template <typename UserClass, ESPMode Mode, typename... VarTypes>
864 inline FDelegateHandle AddSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
865 {
866 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
867
868 return Super::AddDelegateInstance(FDelegate::CreateSP(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...));
869 }
870 template <typename UserClass, ESPMode Mode, typename... VarTypes>
871 inline FDelegateHandle AddSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
872 {
873 return Super::AddDelegateInstance(FDelegate::CreateSP(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...));
874 }
875
884 template <typename UserClass, typename... VarTypes>
885 inline FDelegateHandle AddSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
886 {
887 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
888
889 return Super::AddDelegateInstance(FDelegate::CreateSP(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
890 }
891 template <typename UserClass, typename... VarTypes>
892 inline FDelegateHandle AddSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
893 {
894 return Super::AddDelegateInstance(FDelegate::CreateSP(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
895 }
896
905 template <typename UserClass, typename... VarTypes>
906 inline FDelegateHandle AddThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
907 {
908 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
909
910 return Super::AddDelegateInstance(FDelegate::CreateThreadSafeSP(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...));
911 }
912 template <typename UserClass, typename... VarTypes>
913 inline FDelegateHandle AddThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
914 {
915 return Super::AddDelegateInstance(FDelegate::CreateThreadSafeSP(InUserObjectRef, InFunc, Forward<VarTypes>(Vars)...));
916 }
917
928 template <typename UserClass, typename... VarTypes>
929 inline FDelegateHandle AddThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
930 {
931 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
932
933 return Super::AddDelegateInstance(FDelegate::CreateThreadSafeSP(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
934 }
935 template <typename UserClass, typename... VarTypes>
936 inline FDelegateHandle AddThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
937 {
938 return Super::AddDelegateInstance(FDelegate::CreateThreadSafeSP(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
939 }
940
949 template <typename UObjectTemplate, typename... VarTypes>
951 {
952 return Super::AddDelegateInstance(FDelegate::CreateUFunction(InUserObject, InFunctionName, Forward<VarTypes>(Vars)...));
953 }
954 template <typename UObjectTemplate, typename... VarTypes>
956 {
957 return Super::AddDelegateInstance(FDelegate::CreateUFunction(InUserObject, InFunctionName, Forward<VarTypes>(Vars)...));
958 }
959
968 template <typename UserClass, typename... VarTypes>
969 inline FDelegateHandle AddUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
970 {
971 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
972
973 return Super::AddDelegateInstance(FDelegate::CreateUObject(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
974 }
975 template <typename UserClass, typename... VarTypes>
976 inline FDelegateHandle AddUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
977 {
978 return Super::AddDelegateInstance(FDelegate::CreateUObject(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
979 }
980 template <typename UserClass, typename... VarTypes>
981 inline FDelegateHandle AddUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
982 {
983 static_assert(!std::is_const_v<UserClass>, "Attempting to bind a delegate with a const object pointer and non-const member function.");
984
985 return Super::AddDelegateInstance(FDelegate::CreateUObject(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
986 }
987 template <typename UserClass, typename... VarTypes>
988 inline FDelegateHandle AddUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
989 {
990 return Super::AddDelegateInstance(FDelegate::CreateUObject(InUserObject, InFunc, Forward<VarTypes>(Vars)...));
991 }
992
993public:
994
1004 {
1005 bool bResult = false;
1006 if (Handle.IsValid())
1007 {
1008 bResult = RemoveDelegateInstance(Handle);
1009 }
1010 return bResult;
1011 }
1012
1013 // Broadcasting via a delegate registration reference is not allowed
1014 void Broadcast(ParamTypes... Params) = delete;
1015};
1016
1027template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
1029{
1030 static_assert(sizeof(DelegateSignature) == 0, "Expected a function signature for the delegate template parameter");
1031};
1032
1033template <typename RetValType, typename... ParamTypes, typename UserPolicy>
1034class TMulticastDelegate<RetValType(ParamTypes...), UserPolicy>
1035{
1036 static_assert(sizeof(RetValType) == 0, "The return type of a multicast delegate must be void");
1037};
1038
1039template <typename... ParamTypes, typename UserPolicy>
1040class TMulticastDelegate<void(ParamTypes...), UserPolicy> : public TMulticastDelegateRegistration<void(ParamTypes...), UserPolicy>
1041{
1042private:
1043 using Super = TMulticastDelegateRegistration<void(ParamTypes...), UserPolicy>;
1044 using DelegateInstanceInterfaceType = typename Super::DelegateInstanceInterfaceType;
1045
1046public:
1048
1050
1052 {
1053 *this = Other;
1054 }
1055
1057 {
1058 if (&Other != this)
1059 {
1061 }
1062 return *this;
1063 }
1064
1068
1074 void Broadcast(ParamTypes... Params) const
1075 {
1076 Super::Super::template Broadcast<typename Super::DelegateInstanceInterfaceType, ParamTypes...>(Params...);
1077 }
1078};
1079
1080template <typename DelegateSignature>
1082
1083template <typename DelegateSignature>
1085
1086
1092template <typename ThreadSafetyMode, typename RetValType, typename... ParamTypes>
1093class TBaseDynamicDelegate : public TScriptDelegate<ThreadSafetyMode>
1094{
1095public:
1100
1109
1113 template< class UserClass >
1115 {
1116 public:
1117 typedef RetValType (UserClass::*FMethodPtr)(ParamTypes... Params);
1118 };
1119
1130 template< class UserClass >
1132 {
1133 check( InUserObject != nullptr && InMethodPtr != nullptr );
1134
1135 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1136
1137 // NOTE: If you hit a compile error on the following line, it means you're trying to use a non-UObject type
1138 // with this delegate, which is not supported
1139 this->Object = Cast<UObject>(InUserObject);
1140
1141 // Store the function name. The incoming function name was generated by a macro and includes the method's class name.
1143
1144 ensureMsgf(this->IsBound(), TEXT("Unable to bind delegate to '%s' (function might not be marked as a UFUNCTION or object may be pending kill)"), *InFunctionName.ToString());
1145 }
1146 template< class UserClass >
1151
1152 // NOTE: Execute() method must be defined in derived classes
1153
1154 // NOTE: ExecuteIfBound() method must be defined in derived classes
1155};
1156
1157
1164template <typename ThreadSafetyMode, typename RetValType, typename... ParamTypes>
1166{
1167public:
1169 typedef TBaseDynamicDelegate<ThreadSafetyMode, RetValType, ParamTypes...> FDelegate;
1170
1175
1184
1196 template< class UserClass >
1197 bool __Internal_IsAlreadyBound( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName ) const
1198 {
1199 check( InUserObject != nullptr && InMethodPtr != nullptr );
1200
1201 // NOTE: We're not actually using the incoming method pointer or calling it. We simply require it for type-safety reasons.
1202
1203 return this->Contains( InUserObject, InFunctionName );
1204 }
1205 template< class UserClass >
1206 bool __Internal_IsAlreadyBound( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName ) const
1207 {
1209 }
1210
1221 template< class UserClass >
1222 void __Internal_AddDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1223 {
1224 check( InUserObject != nullptr && InMethodPtr != nullptr );
1225
1226 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1227
1230
1231 this->Add( NewDelegate );
1232 }
1233 template< class UserClass >
1234 void __Internal_AddDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1235 {
1237 }
1238
1249 template< class UserClass >
1250 void __Internal_AddUniqueDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1251 {
1252 check( InUserObject != nullptr && InMethodPtr != nullptr );
1253
1254 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1255
1258
1259 this->AddUnique( NewDelegate );
1260 }
1261 template< class UserClass >
1262 void __Internal_AddUniqueDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1263 {
1265 }
1266
1277 template< class UserClass >
1278 void __Internal_RemoveDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1279 {
1280 check( InUserObject != nullptr && InMethodPtr != nullptr );
1281
1282 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1283
1284 this->Remove( InUserObject, InFunctionName );
1285 }
1286 template< class UserClass >
1287 void __Internal_RemoveDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1288 {
1290 }
1291
1292 // NOTE: Broadcast() method must be defined in derived classes
1293};
1294
1295#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_5
1296#include "Misc/Crc.h"
1297#endif
1298
1299#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
1300#include "Templates/IsConst.h"
1302#endif
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
typename TCopyQualifiersFromTo< From, To >::Type TCopyQualifiersFromTo_T
Definition CopyQualifiersFromTo.h:17
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TYPE_OF_NULLPTR TYPE_OF_NULLPTR
The type of the C++ nullptr keyword.
Definition Platform.h:1157
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
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
TCopyQualifiersFromTo_T< From, To > * Cast(From *Src)
Definition Casts.h:95
T * ToRawPtr(const TObjectPtr< T > &Ptr)
Definition ObjectPtr.h:1000
typename TIdentity< T >::Type TIdentity_T
Definition Identity.h:24
ESPMode
Definition SharedPointerFwd.h:12
UE_REWRITE T CopyTemp(T &Val)
Definition UnrealTemplate.h:554
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition IDelegateInstance.h:14
Definition NameTypes.h:617
CORE_API FString ToString() const
Definition UnrealNames.cpp:3537
Definition IDelegateInstance.h:112
Definition DelegateSignatureImpl.inl:1115
RetValType(UserClass::* FMethodPtr)(ParamTypes... Params)
Definition DelegateSignatureImpl.inl:1117
Definition DelegateSignatureImpl.inl:1094
void __Internal_BindDynamic(TObjectPtr< UserClass > InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1147
TBaseDynamicDelegate(const TScriptDelegate< ThreadSafetyMode > &InScriptDelegate)
Definition DelegateSignatureImpl.inl:1106
TBaseDynamicDelegate()
Definition DelegateSignatureImpl.inl:1099
void __Internal_BindDynamic(UserClass *InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1131
Definition DelegateSignatureImpl.inl:1166
TBaseDynamicDelegate< ThreadSafetyMode, RetValType, ParamTypes... > FDelegate
Definition DelegateSignatureImpl.inl:1169
void __Internal_AddUniqueDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1250
void __Internal_RemoveDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1287
void __Internal_AddDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1222
TBaseDynamicMulticastDelegate(const TMulticastScriptDelegate< ThreadSafetyMode > &InMulticastScriptDelegate)
Definition DelegateSignatureImpl.inl:1181
TBaseDynamicMulticastDelegate()
Definition DelegateSignatureImpl.inl:1174
void __Internal_AddUniqueDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1262
void __Internal_AddDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1234
bool __Internal_IsAlreadyBound(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName) const
Definition DelegateSignatureImpl.inl:1197
void __Internal_RemoveDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
Definition DelegateSignatureImpl.inl:1278
bool __Internal_IsAlreadyBound(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName) const
Definition DelegateSignatureImpl.inl:1206
Definition DelegateInstancesImplFwd.h:53
Definition DelegateInstancesImplFwd.h:35
Definition DelegateInstancesImplFwd.h:29
Definition DelegateInstancesImplFwd.h:23
Definition DelegateInstancesImplFwd.h:47
Definition DelegateInstancesImplFwd.h:17
Definition DelegateInstancesImplFwd.h:41
void BindUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:264
void BindUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:259
void BindUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:295
void BindLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:126
void BindThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:240
InRetValType RetValType
Definition DelegateSignatureImpl.inl:100
void BindSPLambda(const UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:141
void BindSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:186
void BindWeakLambda(const UObject *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:151
void BindSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:198
TDelegateRegistration & operator=(const TDelegateRegistration &)=default
bool ExecuteIfBound(ParamTypes... Params) const =delete
void BindSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:179
RetValType Execute(ParamTypes... Params) const =delete
void BindUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:288
void BindSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:205
InRetValType(ParamTypes...) FuncType
Definition DelegateSignatureImpl.inl:76
void BindThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:219
void BindThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:226
InRetValType(ParamTypes...) TFuncType
Definition DelegateSignatureImpl.inl:101
void BindRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:170
TDelegateRegistration & operator=(TDelegateRegistration &&)=default
void BindThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:247
void BindSPLambda(const TSharedRef< UserClass, Mode > &InUserObjectRef, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:136
void BindUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:283
void BindStatic(typename TBaseStaticDelegateInstance< FuncType, UserPolicy, std::decay_t< VarTypes >... >::FFuncPtr InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:116
void BindRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:163
TDelegateRegistration(const TDelegateRegistration &)=default
void BindUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:276
Definition DelegateSignatureImpl.inl:67
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateWeakLambda(const UObject *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:408
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:493
TDelegate(TYPE_OF_NULLPTR)
Definition DelegateSignatureImpl.inl:342
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:548
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:527
TDelegate(const TDelegate &Other)
Definition DelegateSignatureImpl.inl:346
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:468
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:587
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:541
UE_FORCEINLINE_HINT const DelegateInstanceInterfaceType * GetDelegateInstanceProtected() const
Definition DelegateSignatureImpl.inl:645
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:454
InRetValType(ParamTypes...) TFuncType
Definition DelegateSignatureImpl.inl:333
typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type TMethodPtr
Definition DelegateSignatureImpl.inl:337
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:477
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:502
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateStatic(TIdentity_T< RetValType(*)(ParamTypes..., std::decay_t< VarTypes >...)> InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:365
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:445
typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type TConstMethodPtr
Definition DelegateSignatureImpl.inl:338
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:422
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:431
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:578
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSPLambda(UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:396
RetValType Execute(ParamTypes... Params) const
Definition DelegateSignatureImpl.inl:603
InRetValType RetValType
Definition DelegateSignatureImpl.inl:332
RetValType(*)(ParamTypes..., VarTypes...) TFuncPtr
Definition DelegateSignatureImpl.inl:336
TDelegate & operator=(TDelegate &&Other)=default
TDelegate & operator=(const TDelegate &Other)
Definition DelegateSignatureImpl.inl:351
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:562
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:571
bool ExecuteIfBound(ParamTypes... Params) const
Definition DelegateSignatureImpl.inl:623
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSPLambda(const TSharedRef< UserClass, Mode > &InUserObjectRef, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:389
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:518
UE_FORCEINLINE_HINT DelegateInstanceInterfaceType * GetDelegateInstanceProtected()
Definition DelegateSignatureImpl.inl:641
static TDelegate< RetValType(ParamTypes...), UserPolicy > CreateLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:377
Definition DelegateSignatureImpl.inl:310
Definition MulticastDelegateBase.h:28
FDelegateHandle AddSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:871
FDelegateHandle AddThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:913
TMulticastDelegateRegistration(TMulticastDelegateRegistration &&)=default
FDelegateHandle AddUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:981
FDelegateHandle AddUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:969
FDelegateHandle AddUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:950
TMulticastDelegateRegistration & operator=(const TMulticastDelegateRegistration &)=default
TMulticastDelegateRegistration(const TMulticastDelegateRegistration &)=default
FDelegateHandle Add(FDelegate &&InNewDelegate)
Definition DelegateSignatureImpl.inl:769
FDelegateHandle AddSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:864
FDelegateHandle AddRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:843
FDelegateHandle AddUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:988
TMulticastDelegateRegistration & operator=(TMulticastDelegateRegistration &&)=default
FDelegateHandle AddSPLambda(const UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:815
FDelegateHandle AddThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:906
FDelegateHandle AddStatic(typename TBaseStaticDelegateInstance< void(ParamTypes...), UserPolicy, std::decay_t< VarTypes >... >::FFuncPtr InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:790
bool Remove(FDelegateHandle Handle)
Definition DelegateSignatureImpl.inl:1003
typename UserPolicy::FMulticastDelegateExtras Super
Definition DelegateSignatureImpl.inl:731
FDelegateHandle AddLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:802
FDelegateHandle AddThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:929
FDelegateHandle AddSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:885
FDelegateHandle Add(const FDelegate &InNewDelegate)
Definition DelegateSignatureImpl.inl:779
FDelegateHandle AddRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:850
FDelegateHandle AddWeakLambda(UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:828
FDelegateHandle AddUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:955
FDelegateHandle AddSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:892
FDelegateHandle AddUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:976
FDelegateHandle AddThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
Definition DelegateSignatureImpl.inl:936
Definition DelegateSignatureImpl.inl:725
TMulticastDelegate(const TMulticastDelegate &Other)
Definition DelegateSignatureImpl.inl:1051
void Broadcast(ParamTypes... Params) const
Definition DelegateSignatureImpl.inl:1074
TMulticastDelegate & operator=(TMulticastDelegate &&)=default
TMulticastDelegate(TMulticastDelegate &&)=default
TMulticastDelegate & operator=(const TMulticastDelegate &Other)
Definition DelegateSignatureImpl.inl:1056
Definition DelegateSignatureImpl.inl:1029
Definition ScriptDelegates.h:509
typename UE::Core::Private::TScriptDelegateTraits< ThreadSafetyMode >::ThreadSafetyMode ThreadSafetyMode
Definition ScriptDelegates.h:520
void AddUnique(const TScriptDelegate< ThreadSafetyMode > &InDelegate)
Definition ScriptDelegates.h:695
bool Contains(const TScriptDelegate< ThreadSafetyMode > &InDelegate) const
Definition ScriptDelegates.h:602
Definition ScriptDelegates.h:66
FName FunctionName
Definition ScriptDelegates.h:488
bool IsBound() const
Definition ScriptDelegates.h:193
typename UE::Core::Private::TScriptDelegateTraits< ThreadSafetyMode >::ThreadSafetyMode ThreadSafetyMode
Definition ScriptDelegates.h:68
WeakPtrType Object
Definition ScriptDelegates.h:485
Definition SharedPointer.h:153
Definition DelegateInstancesImplFwd.h:59
Definition SharedPointer.h:1295
Definition Object.h:95
Definition WeakObjectPtr.h:49
Definition DelegateInstanceInterface.h:12
Definition DelegateInstanceInterface.h:49
Definition ObjectPtr.h:488
Definition DelegateBase.h:205