UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ChunkStore.fake.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
5
6#if WITH_DEV_AUTOMATION_TESTS
7
8namespace BuildPatchServices
9{
10 class FFakeChunkStore
11 : public FMockChunkStore
12 {
13 public:
14 virtual void Put(const FGuid& DataId, TUniquePtr<IChunkDataAccess> ChunkData) override
15 {
16 FScopeLock ScopeLock(&ThreadLock);
17 Store.Add(DataId, MoveTemp(ChunkData));
18 RxPut.Emplace(FStatsCollector::GetSeconds(), DataId);
19 }
20
21 virtual IChunkDataAccess* Get(const FGuid& DataId) override
22 {
23 FScopeLock ScopeLock(&ThreadLock);
24 IChunkDataAccess* Result = nullptr;
25 if (Store.Contains(DataId))
26 {
27 Result = Store[DataId].Get();
28 }
29 RxGet.Emplace(FStatsCollector::GetSeconds(), Result, DataId);
30 return Result;
31 }
32
33 virtual TUniquePtr<IChunkDataAccess> Remove(const FGuid& DataId) override
34 {
35 FScopeLock ScopeLock(&ThreadLock);
37 if (Store.Contains(DataId))
38 {
39 ReturnValue = MoveTemp(Store[DataId]);
40 Store.Remove(DataId);
41 }
42 RxRemove.Emplace(FStatsCollector::GetSeconds(), DataId);
43 return ReturnValue;
44 }
45
46 virtual int32 GetSize() const override
47 {
48 FScopeLock ScopeLock(&ThreadLock);
49 int32 Result = StoreMax - Store.Num();
50 RxGetSize.Emplace(FStatsCollector::GetSeconds(), Result);
51 return Result;
52 }
53
54 public:
55 mutable FCriticalSection ThreadLock;
58 };
59}
60
61#endif //WITH_DEV_AUTOMATION_TESTS
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
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition ScopeLock.h:141
Definition UnrealString.h.inl:34
Definition UniquePtr.h:107
Definition BuildPatchFileConstructor.h:28
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
FORCEINLINE void Store(const volatile T *Element, T Value)
Definition Atomic.h:89
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
Definition Guid.h:109