UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
OnDemandBackendStatus.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "IO/IoChunkId.h"
8
9#include <atomic>
10
11namespace UE::IoStore
12{
13
15{
16public:
17
18 enum class EFlags : uint8
19 {
20 None = 0,
21 CacheEnabled = 1 << 0,
22 HttpEnabled = 1 << 1,
24
25 // When adding new values here, remember to update operator<<(FStringBuilderBase& Sb, EFlags StatusFlags) in the cpp!
26 };
27
28 bool IsHttpEnabled() const
29 {
30 return IsHttpEnabled(Flags.load(std::memory_order_relaxed));
31 }
32
33 bool IsHttpEnabled(EIoChunkType ChunkType) const;
34
35 bool IsCacheEnabled() const
36 {
37 return HasAnyFlags(EFlags::CacheEnabled);
38 }
39
40 bool IsCacheWriteable() const
41 {
42 const uint8 CurrentFlags = Flags.load(std::memory_order_relaxed);
44 }
45
46 bool IsCacheReadOnly() const
47 {
48 const uint8 CurrentFlags = Flags.load(std::memory_order_relaxed);
50 }
51
52 void SetHttpEnabled(bool bEnabled)
53 {
54 AddOrRemoveFlags(EFlags::HttpEnabled, bEnabled, TEXT("HTTP streaming enabled"));
55 FGenericCrashContext::SetEngineData(TEXT("IAS.Enabled"), bEnabled ? TEXT("true") : TEXT("false"));
56 }
57
58 void SetHttpOptionalBulkEnabled(bool bEnabled)
59 {
60 AddOrRemoveFlags(EFlags::HttpBulkOptionalDisabled, bEnabled == false, TEXT("HTTP streaming of optional bulk data disabled"));
61 }
62
63 void SetCacheEnabled(bool bEnabled)
64 {
65 AddOrRemoveFlags(EFlags::CacheEnabled, bEnabled, TEXT("Cache enabled"));
66 }
67
68 void ToString(FStringBuilderBase& Builder) const;
69
70private:
71
72 static bool IsHttpEnabled(uint8 FlagsToTest);
73
74 bool HasAnyFlags(uint8 Contains) const
75 {
76 return (Flags.load(std::memory_order_relaxed) & Contains) != 0;
77 }
78
79 bool HasAnyFlags(EFlags Contains) const
80 {
81 return HasAnyFlags(uint8(Contains));
82 }
83
84 uint8 AddFlags(EFlags FlagsToAdd)
85 {
86 return Flags.fetch_or(uint8(FlagsToAdd));
87 }
88
89 uint8 RemoveFlags(EFlags FlagsToRemove)
90 {
91 return Flags.fetch_and(static_cast<uint8>(~uint8(FlagsToRemove)));
92 }
93
94 uint8 AddOrRemoveFlags(EFlags FlagsToAddOrRemove, bool bValue)
95 {
96 return bValue ? AddFlags(FlagsToAddOrRemove) : RemoveFlags(FlagsToAddOrRemove);
97 }
98
99 void AddOrRemoveFlags(EFlags FlagsToAddOrRemove, bool bValue, const TCHAR* DebugText);
100
102
103 std::atomic<uint8> Flags{ 0 };
104};
105
106} // namespace UE::IoStore
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EIoChunkType
Definition IoChunkId.h:28
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition OnDemandBackendStatus.h:15
bool IsCacheEnabled() const
Definition OnDemandBackendStatus.h:35
void SetHttpEnabled(bool bEnabled)
Definition OnDemandBackendStatus.h:52
void SetCacheEnabled(bool bEnabled)
Definition OnDemandBackendStatus.h:63
bool IsCacheReadOnly() const
Definition OnDemandBackendStatus.h:46
void SetHttpOptionalBulkEnabled(bool bEnabled)
Definition OnDemandBackendStatus.h:58
friend FStringBuilderBase & operator<<(FStringBuilderBase &Sb, EFlags StatusFlags)
Definition OnDemandBackendStatus.cpp:81
EFlags
Definition OnDemandBackendStatus.h:19
bool IsHttpEnabled() const
Definition OnDemandBackendStatus.h:28
bool IsCacheWriteable() const
Definition OnDemandBackendStatus.h:40
NO_LOGGING.
Definition Client.h:20
static CORE_API void SetEngineData(const FString &Key, const FString &Value)
Definition GenericPlatformCrashContext.cpp:1462