UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LinkerPlaceholderBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UObject/Class.h"
10#include "UObject/Field.h"
11
13{
14#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
16#else
17 return false;
18#endif
19}
20
21/*******************************************************************************
22 * FPlaceholderContainerTracker / FScopedPlaceholderPropertyTracker
23 ******************************************************************************/
24
33{
34public:
44 {
45 if (bEnabled)
46 {
47 Pop();
48 }
49 }
50
51private:
52 const bool bEnabled;
53 UObject* PlaceholderReferencerCandidate;
54
56 void Pop();
57};
58
67{
68public:
77
79 {
80 if (bEnabled)
81 {
82 Pop();
83 }
84 }
85
86private:
87 const bool bEnabled;
88 FFieldVariant IntermediateProperty;
89
91 void Pop();
92};
93
94/*******************************************************************************
95 * TLinkerPlaceholderBase<>
96 ******************************************************************************/
97
99{
100public:
102 virtual ~FLinkerPlaceholderBase();
103
106
109
120
129 virtual bool HasKnownReferences() const;
130
139
140 /*
141 * Sets up the provided placeholder as a subobject of this placeholder.
142 */
144
146 bool IsDeferredSubobject() const {return OwningPlaceholder != nullptr;}
147
150
158 bool HasBeenFullyResolved() const;
159
170
177 bool IsMarkedResolved() const;
178
184 void MarkAsResolved();
185
186private:
194 int32 ResolvePlaceholderPropertyValues(UObject* ReplacementObj);
195
197 bool bResolveWasInvoked;
198
205 struct FPlaceholderValuePropertyPath
206 {
207 FPlaceholderValuePropertyPath(FFieldVariant ReferencingProperty);
208
213 bool IsValid() const;
214
219 UClass* GetOwnerClass() const;
220
231 int32 ResolveRaw(FLinkerPlaceholderBase* Placeholder, UObject* Replacement, void* Container) const;
232
233 private:
235 TArray<FFieldVariant> PropertyChain;
236
237 public:
239 friend uint32 GetTypeHash(const FPlaceholderValuePropertyPath& PlaceholderPropertyRef)
240 {
241 uint32 Hash = 0;
242 for (const FFieldVariant& Property : PlaceholderPropertyRef.PropertyChain)
243 {
244 Hash = HashCombine(Hash, GetTypeHash(Property.GetRawPointer()));
245 }
246 return Hash;
247 }
248
250 friend bool operator==(const FPlaceholderValuePropertyPath& Lhs, const FPlaceholderValuePropertyPath& Rhs)
251 {
252 if (Lhs.PropertyChain.Num() == Rhs.PropertyChain.Num())
253 {
254 for (int32 PropIndex = 0; PropIndex < Lhs.PropertyChain.Num(); ++PropIndex)
255 {
256 if (Lhs.PropertyChain[PropIndex] != Rhs.PropertyChain[PropIndex])
257 {
258 return false;
259 }
260 }
261 return true;
262 }
263 return false;
264 };
265 };
266 friend class FLinkerPlaceholderObjectImpl; // for access to FPlaceholderValuePropertyPath
267 typedef TSet<FPlaceholderValuePropertyPath> FReferencingPropertySet;
268
270 TMap< TWeakObjectPtr<UObject>, FReferencingPropertySet > ReferencingContainers;
271 TMap< void*, FReferencingPropertySet > ReferencingRawContainers;
272
274 TArray<ULinkerPlaceholderExportObject*> PlaceholderSubobjects;
275 ULinkerPlaceholderExportObject* OwningPlaceholder;
276};
277
278/*******************************************************************************
279 * TLinkerImportPlaceholderBase<>
280 ******************************************************************************/
281
282template<class PlaceholderType>
284{
285public:
286 // FLinkerPlaceholderBase interface
287 virtual bool HasKnownReferences() const override;
289 // End FLinkerPlaceholderBase interface
290
298
306
320
325#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
327#endif //USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
328
334private:
342 int32 ResolvePropertyReferences(PlaceholderType* ReplacementObj);
343
347 int32 SpecializedResolvePropertyReferences(PlaceholderType* ReplacementObj);
348
356 int32 ResolveScriptReferences(PlaceholderType* ReplacementObj);
357
359 TSet<FFieldVariant> ReferencingProperties;
360
362 TSet<PlaceholderType**> ReferencingScriptExpressions;
363
364#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
369#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
370
371 TSet<UStruct*> DerivedFunctions;
372};
373
374// Templatized implementation
375#include "UObject/LinkerPlaceholderBase.inl" // IWYU pragma: export
#define FORCEINLINE
Definition AndroidPlatform.h:140
bool GEventDrivenLoaderEnabled
Definition CoreGlobals.cpp:415
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FORCEINLINE bool UseCircularDependencyLoadDeferring()
Definition LinkerPlaceholderBase.h:12
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Field.h:353
Definition LinkerPlaceholderBase.h:99
TArray< ULinkerPlaceholderExportObject * > & GetSubobjectPlaceholders()
Definition LinkerPlaceholderBase.h:149
bool HasBeenFullyResolved() const
Definition LinkerPlaceholderBase.cpp:521
bool IsDeferredSubobject() const
Definition LinkerPlaceholderBase.h:146
TWeakObjectPtr< const UClass > DeferredObjectType
Definition LinkerPlaceholderBase.h:108
void SetupPlaceholderSubobject(ULinkerPlaceholderExportObject *PlaceholderSubobject)
Definition LinkerPlaceholderBase.cpp:514
virtual ~FLinkerPlaceholderBase()
Definition LinkerPlaceholderBase.cpp:462
FLinkerPlaceholderBase()
Definition LinkerPlaceholderBase.cpp:456
virtual int32 ResolveAllPlaceholderReferences(UObject *ReplacementObj)
Definition LinkerPlaceholderBase.cpp:503
bool AddReferencingPropertyValue(FFieldVariant ReferencingProperty, void *DataPtr)
Definition LinkerPlaceholderBase.cpp:470
virtual UObject * GetPlaceholderAsUObject() bool IsMarkedResolved() const
FPackageIndex PackageIndex
Definition LinkerPlaceholderBase.h:105
void MarkAsResolved()
Definition LinkerPlaceholderBase.cpp:533
virtual bool HasKnownReferences() const
Definition LinkerPlaceholderBase.cpp:497
Definition LinkerPlaceholderBase.cpp:33
Definition ObjectResource.h:44
Definition Array.h:670
Definition LinkerPlaceholderBase.h:284
void AddDerivedFunction(UStruct *DerivedFunctionType)
Definition LinkerPlaceholderBase.inl:118
void AddReferencingProperty(FFieldVariant ReferencingProperty)
Definition LinkerPlaceholderBase.inl:85
virtual bool HasKnownReferences() const override
Definition LinkerPlaceholderBase.inl:71
void RemoveReferencingProperty(FFieldVariant ReferencingProperty)
Definition LinkerPlaceholderBase.inl:125
virtual int32 ResolveAllPlaceholderReferences(UObject *ReplacementObj) override
Definition LinkerPlaceholderBase.inl:17
void AddReferencingScriptExpr(PlaceholderType **ExpressionPtr)
Definition LinkerPlaceholderBase.inl:132
Definition UnrealString.h.inl:34
Definition Class.h:3793
Definition LinkerPlaceholderExportObject.h:20
Definition Object.h:95
Definition Class.h:480
Definition LinkerPlaceholderBase.h:33
~FScopedPlaceholderContainerTracker()
Definition LinkerPlaceholderBase.h:43
FScopedPlaceholderContainerTracker(UObject *InPlaceholderContainerCandidate)
Definition LinkerPlaceholderBase.h:35
Definition LinkerPlaceholderBase.h:67
~FScopedPlaceholderPropertyTracker()
Definition LinkerPlaceholderBase.h:78
FScopedPlaceholderPropertyTracker(FFieldVariant InIntermediateProperty)
Definition LinkerPlaceholderBase.h:69
Definition WeakObjectPtrTemplates.h:25