5#include "Containers/Array.h"
6#include "Containers/Map.h"
7#include "Containers/StringFwd.h"
8#include "Containers/StringView.h"
9#include "Containers/UnrealString.h"
11#include "HAL/CriticalSection.h"
12#include "Misc/AssertionMacros.h"
13#include "Serialization/Archive.h"
14#include "Templates/Atomic.h"
15#include "Templates/Function.h"
16#include "Templates/SharedPointer.h"
17#include "Templates/UniquePtr.h"
20class IAsyncReadFileHandle;
21class IAsyncReadRequest;
24#define FPRELOADABLEFILE_TEST_ENABLED 0
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
105 virtual void Seek(int64 InPos)
final;
145
146
147
148
175 void Set(
bool bInCanceled, IAsyncReadRequest* InReadRequest)
180 void Get(
bool& bOutCanceled, IAsyncReadRequest*& OutReadRequest)
190 SavedReadCompleteArguments;
192 friend class FPreloadableFileProxy;
196
197
198
199
200
201
202
203
204
205
206
217
218
219
220
221
222 static bool TryRegister(
const TSharedPtr<FPreloadableFile>& PreloadableFile);
224
225
226
227
228
231 static bool UnRegister(
const TSharedPtr<FPreloadableFile>& PreloadableFile);
239
240
241
242
251 virtual void Seek(int64 InPos)
final
253 Archive->Seek(InPos);
257 return Archive->Tell();
261 return Archive->TotalSize();
265 return Archive->Close();
269 Archive->Serialize(V, Length);
273 return Archive->GetArchiveName();
#define FPRELOADABLEFILE_TEST_ENABLED
FWindowsCriticalSection FCriticalSection
TAtomic< int64 > CacheEnd
bool bReadCompleteWasCalledInline
FCriticalSection PreloadLock
bool IsPreloading() const
virtual bool Close() final
void SetPageSize(int64 PageSize)
TArray< IAsyncReadRequest * > RetiredRequests
TAtomic< bool > bIsPreloadingPaused
FArchive * DetachLowerLevel()
virtual ~FPreloadableArchive()
bool ResumePreloadNonRecursive()
TAtomic< bool > bIsPreloading
void SerializeSynchronously(void *V, int64 Length)
virtual int64 Tell() final
void OnReadComplete(bool bCanceled, IAsyncReadRequest *ReadRequest)
void WaitForInitialization() const
virtual void Serialize(void *V, int64 Length) final
bool IsCacheAllocated() const
void InitializeInternalAsync(FCreateArchive &&InCreateArchiveFunction, FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 InFlags, int64 PrimeSize)
bool bIsInlineReadComplete
bool IsInitialized() const
void InitializeInternal(FCreateArchive &&InCreateArchiveFunction, FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 Flags, int64 PrimeSize)
virtual FString GetArchiveName() const final
TUniqueFunction< IAsyncReadFileHandle *()> FCreateAsyncArchive
FPreloadableArchive(FStringView ArchiveName)
TUniquePtr< FArchive > SynchronousArchive
virtual void Seek(int64 InPos) final
TUniqueFunction< FArchive *()> FCreateArchive
TAtomic< bool > bInitialized
void FreeRetiredRequests()
TUniquePtr< IAsyncReadFileHandle > AsynchronousHandle
FEvent * PendingAsyncComplete
void InitializeAsync(FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
void InitializeAsync(FCreateArchive &&InCreateArchiveFunction, uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
virtual int64 TotalSize() final
virtual int64 Tell() final
virtual void Serialize(void *V, int64 Length) final
TSharedPtr< FPreloadableArchive > Archive
FPreloadableArchiveProxy(const TSharedPtr< FPreloadableArchive > &InArchive)
virtual bool Close() final
virtual FString GetArchiveName() const final
virtual void Seek(int64 InPos) final
virtual int64 TotalSize() final
FPreloadableFile(FStringView FileName)
static FArchive * TryTakeArchive(const TCHAR *FileName)
static bool TryRegister(const TSharedPtr< FPreloadableFile > &PreloadableFile)
static TMap< FString, TSharedPtr< FPreloadableFile > > RegisteredFiles
void InitializeAsync(uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
static bool UnRegister(const TSharedPtr< FPreloadableFile > &PreloadableFile)
void Set(bool bInCanceled, IAsyncReadRequest *InReadRequest)
IAsyncReadRequest * ReadRequest
void Get(bool &bOutCanceled, IAsyncReadRequest *&OutReadRequest)