UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ConfigAccessTracking.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*---------------------------------------------------------------------------------------------------------------------
4 Access tracking for Config cache. When compiled in, adds extra data to FConfigFile structures so that we can report
5 File,Section,Value names whenever an FConfigValue is read. The data about any accessed ConfigValue is reported to
6 callbacks registered via UE::ConfigAccessTracking::AddConfigValueReadCallback.
7---------------------------------------------------------------------------------------------------------------------*/
8#pragma once
9
10#include "HAL/Platform.h"
11#include "UObject/NameTypes.h"
12
13#define UE_WITH_CONFIG_TRACKING (WITH_EDITOR || 0)
14
15#if UE_WITH_CONFIG_TRACKING
16#include <atomic>
18#include "Templates/Function.h"
20
21class FConfigCacheIni;
22class FConfigFile;
23class FConfigSection;
24struct FConfigValue;
25#endif
26
27#if WITH_EDITOR || UE_WITH_CONFIG_TRACKING
28
30{
31
36enum class ELoadType : uint8
37{
38 ConfigSystem,
43 Manual,
46};
47
48} // namespace UE::ConfigAccessTracking
49
50#endif // WITH_EDITOR || UE_WITH_CONFIG_TRACKING
51
52#if UE_WITH_CONFIG_TRACKING
53
55{
56
63struct FFile : public FRefCountBase
64{
65 CORE_API FFile(const FConfigFile* InConfigFile);
67 CORE_API FName GetPlatformName();
68 CORE_API void SetAsLoadTypeConfigSystem(FConfigCacheIni& ConfigSystem, FConfigFile& ConfigFile);
69
70public:
71 const FConfigFile* ConfigFile = nullptr;
73private:
74 FName PlatformName = NAME_None;
76 bool bSavedHasConfigFile : 1; // = false;
77 bool bSavedConfigFileHasPlatformName : 1; // = false;
78 bool bPlatformNameInitialized : 1; // = false;
79 bool bOverridePlatformName : 1; // = false;
80 bool bSavedOverridePlatformName : 1; // = false;
81};
82
91struct FSection : public FRefCountBase
92{
94
96 FNameEntryId SectionName;
97};
98
100using FConfigValueReadCallbackFunc = TFunction<void(UE::ConfigAccessTracking::FSection* Section,
101 FMinimalName ValueName, const FConfigValue& ConfigValue)>;
102
105{
106 int32 Id = -1;
107 bool IsValid() { return Id != -1; }
108};
109
114
116struct FIgnoreScope
117{
118public:
121
122private:
123 bool bPreviousIgnoreReads = false;
124};
125
126namespace Private
127{
128
133extern CORE_API std::atomic<int32> ConfigValueReadCallbackQuantity;
134
135CORE_API void OnConfigValueReadInternal(UE::ConfigAccessTracking::FSection* Section, FMinimalName ValueName,
137
138inline void OnConfigValueRead(UE::ConfigAccessTracking::FSection* Section, FMinimalName ValueName,
140{
141 if (ConfigValueReadCallbackQuantity.load(std::memory_order_acquire) > 0)
142 {
143 OnConfigValueReadInternal(Section, ValueName, ConfigValue);
144 }
145}
146
147} // namespace Private
148
149} // namespace UE::ConfigAccessTracking
150
151#else // UE_WITH_CONFIG_TRACKING
152
154{
155
156// Declare FSection even though it is undefined so that we can pass FSection* as an argument to FConfigSection and FConfigValue
157// constructors rather than having to create separate constructors under #ifdef UE_WITH_CONFIG_TRACKING
158struct FSection;
159
160// Define FIgnoreScope even when !UE_WITH_CONFIG_TRACKING so we don't need to wrap its use in a macro.
166
167} // namespace UE::ConfigAccessTracking
168
169#endif // else !UE_WITH_CONFIG_TRACKING
170
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
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
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ConfigCacheIni.h:1240
Definition ConfigCacheIni.h:566
Definition ConfigCacheIni.h:407
Definition NameTypes.h:617
Definition RefCounting.h:213
Definition AndroidPlatformMisc.h:14
Definition RefCounting.h:454
Definition OverriddenPropertySet.cpp:45
Definition ConfigAccessTracking.h:154
Definition ConfigCacheIni.h:124
Definition NameTypes.h:439
Definition NameTypes.h:69
Definition ConfigAccessTracking.h:162
FIgnoreScope()
Definition ConfigAccessTracking.h:163
~FIgnoreScope()
Definition ConfigAccessTracking.h:164