Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FPreloadableFile Class Reference

#include <PreloadableFile.h>

+ Inheritance diagram for FPreloadableFile:
+ Collaboration diagram for FPreloadableFile:

Public Member Functions

 FPreloadableFile (FStringView FileName)
 
void InitializeAsync (uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
 
- Public Member Functions inherited from FPreloadableArchive
 FPreloadableArchive (FStringView ArchiveName)
 
virtual ~FPreloadableArchive ()
 
void SetPageSize (int64 PageSize)
 
void InitializeAsync (FCreateArchive &&InCreateArchiveFunction, uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
 
void InitializeAsync (FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 InFlags=Flags::None, int64 PrimeSize=DefaultPrimeSize)
 
bool IsInitialized () const
 
void WaitForInitialization () const
 
bool StartPreload ()
 
void StopPreload ()
 
bool IsPreloading () const
 
bool AllocateCache ()
 
void ReleaseCache ()
 
bool IsCacheAllocated () const
 
FArchiveDetachLowerLevel ()
 
virtual void Serialize (void *V, int64 Length) final
 
virtual void Seek (int64 InPos) final
 
virtual int64 Tell () final
 
virtual int64 TotalSize () final
 
virtual bool Close () final
 
virtual FString GetArchiveName () const final
 
- Public Member Functions inherited from FArchive
 FArchive ()=default
 
 FArchive (const FArchive &)=default
 
FArchiveoperator= (const FArchive &ArchiveToCopy)=default
 
 ~FArchive ()=default
 
virtual FArchiveoperator<< (FName &Value)
 
virtual FArchiveoperator<< (FText &Value)
 
virtual FArchiveoperator<< (UObject *&Value)
 
virtual FArchiveoperator<< (FField *&Value)
 
template<class T >
FORCEINLINE FArchiveoperator<< (TCheckedObjPtr< T > &Value)
 
virtual FArchiveoperator<< (struct FLazyObjectPtr &Value)
 
virtual FArchiveoperator<< (struct FObjectPtr &Value)
 
virtual FArchiveoperator<< (struct FSoftObjectPtr &Value)
 
virtual FArchiveoperator<< (struct FSoftObjectPath &Value)
 
virtual FArchiveoperator<< (struct FWeakObjectPtr &Value)
 
virtual void ForceBlueprintFinalization ()
 
virtual void SerializeBits (void *V, int64 LengthBits)
 
virtual void SerializeInt (uint32 &Value, uint32 Max)
 
virtual void SerializeIntPacked (uint32 &Value)
 
virtual void Preload (UObject *Object)
 
FArchiveStateGetArchiveState ()
 
const FArchiveStateGetArchiveState () const
 
virtual void AttachBulkData (UObject *Owner, FBulkData *BulkData)
 
virtual void AttachBulkData (UE::Serialization::FEditorBulkData *BulkData)
 
virtual void DetachBulkData (FBulkData *BulkData, bool bEnsureBulkDataIsLoaded)
 
virtual void DetachBulkData (UE::Serialization::FEditorBulkData *BulkData, bool bEnsureBulkDataIsLoaded)
 
virtual bool SerializeBulkData (FBulkData &BulkData, const struct FBulkDataSerializationParams &Params)
 
virtual bool IsProxyOf (FArchive *InOther) const
 
virtual bool Precache (int64 PrecacheOffset, int64 PrecacheSize)
 
virtual void FlushCache ()
 
virtual bool SetCompressionMap (TArray< struct FCompressedChunk > *CompressedChunks, ECompressionFlags CompressionFlags)
 
virtual void Flush ()
 
void SerializeCompressed (void *V, int64 Length, FName CompressionFormatCannotChange, ECompressionFlags Flags=COMPRESS_NoFlags, bool bTreatBufferAsFileReader=false)
 
void SerializeCompressedNew (void *V, int64 Length, FName CompressionFormatToEncode, FName CompressionFormatToDecodeOldV1Files, ECompressionFlags Flags=COMPRESS_NoFlags, bool bTreatBufferAsFileReader=false, int64 *OutPartialReadLength=nullptr)
 
void SerializeCompressedNew (void *V, int64 Length)
 
void ByteSwap (void *V, int32 Length)
 
FORCEINLINE FArchiveByteOrderSerialize (void *V, int32 Length)
 
void StartSerializingDefaults ()
 
void StopSerializingDefaults ()
 
virtual void MarkScriptSerializationStart (const UObject *Obj)
 
virtual void MarkScriptSerializationEnd (const UObject *Obj)
 
virtual void MarkSearchableName (const UObject *TypeObject, const FName &ValueName) const
 
template<typename FmtType , typename... Types>
void Logf (const FmtType &Fmt, Types... Args)
 
virtual void UsingCustomVersion (const struct FGuid &Guid)
 
virtual FArchiveGetCacheableArchive ()
 
virtual void PushSerializedProperty (struct FProperty *InProperty, const bool bIsEditorOnlyProperty)
 
virtual void PopSerializedProperty (struct FProperty *InProperty, const bool bIsEditorOnlyProperty)
 
virtual bool AttachExternalReadDependency (FExternalReadCallback &ReadCallback)
 
template<SIZE_T Size>
FORCEINLINE bool FastPathLoad (void *InDest)
 
virtual void PushFileRegionType (EFileRegionType Type)
 
virtual void PopFileRegionType ()
 
void SetArchiveState (const FArchiveState &InState)
 
void SetError ()
 
void ClearError ()
 
virtual FArchiveStateGetInnermostState ()
 
virtual void CountBytes (SIZE_T InNum, SIZE_T InMax)
 
virtual FLinkerGetLinker ()
 
virtual bool AtEnd ()
 
FORCEINLINE bool IsByteSwapping ()
 
void ThisContainsCode ()
 
void ThisContainsMap ()
 
void ThisRequiresLocalizationGather ()
 
virtual UObjectGetArchetypeFromLoader (const UObject *Obj)
 
FORCEINLINE FPackageFileVersion UEVer () const
 
FORCEINLINE int32 UE4Ver () const
 
FORCEINLINE int32 LicenseeUEVer () const
 
FORCEINLINE FEngineVersionBase EngineVer () const
 
uint32 EngineNetVer () const
 
uint32 GameNetVer () const
 
int32 CustomVer (const struct FGuid &Key) const
 
FORCEINLINE bool IsLoading () const
 
FORCEINLINE bool IsLoadingFromCookedPackage () const
 
FORCEINLINE bool IsSaving () const
 
FORCEINLINE bool IsTransacting () const
 
FORCEINLINE bool IsTextFormat () const
 
FORCEINLINE bool WantBinaryPropertySerialization () const
 
FORCEINLINE bool UseUnversionedPropertySerialization () const
 
FORCEINLINE bool IsForcingUnicode () const
 
FORCEINLINE bool IsPersistent () const
 
FORCEINLINE bool GetError () const
 
FORCEINLINE bool IsError () const
 
FORCEINLINE bool IsCriticalError () const
 
FORCEINLINE bool ContainsCode () const
 
FORCEINLINE bool ContainsMap () const
 
FORCEINLINE bool RequiresLocalizationGather () const
 
FORCEINLINE bool ForceByteSwapping () const
 
FORCEINLINE bool IsSerializingDefaults () const
 
FORCEINLINE bool IsIgnoringArchetypeRef () const
 
FORCEINLINE bool DoDelta () const
 
FORCEINLINE bool DoIntraPropertyDelta () const
 
FORCEINLINE bool IsIgnoringOuterRef () const
 
FORCEINLINE bool IsIgnoringClassGeneratedByRef () const
 
FORCEINLINE bool IsIgnoringClassRef () const
 
FORCEINLINE bool IsAllowingLazyLoading () const
 
FORCEINLINE bool IsObjectReferenceCollector () const
 
FORCEINLINE bool IsModifyingWeakAndStrongReferences () const
 
FORCEINLINE bool IsCountingMemory () const
 
FORCEINLINE uint32 GetPortFlags () const
 
FORCEINLINE bool HasAnyPortFlags (uint32 Flags) const
 
FORCEINLINE bool HasAllPortFlags (uint32 Flags) const
 
FORCEINLINE uint32 GetDebugSerializationFlags () const
 
FORCEINLINE bool ShouldSkipBulkData () const
 
FORCEINLINE int64 GetMaxSerializeSize () const
 
virtual const FCustomVersionContainerGetCustomVersions () const
 
virtual void SetCustomVersions (const FCustomVersionContainer &CustomVersionContainer)
 
virtual void ResetCustomVersions ()
 
void SetCustomVersion (const struct FGuid &Key, int32 Version, FName FriendlyName)
 
void SetByteSwapping (bool Enabled)
 
void SetPortFlags (uint32 InPortFlags)
 
void SetDebugSerializationFlags (uint32 InCustomFlags)
 
bool IsFilterEditorOnly () const
 
virtual void SetFilterEditorOnly (bool InFilterEditorOnly)
 
bool IsSaveGame () const
 
FORCEINLINE bool IsNetArchive () const
 
FORCEINLINE bool IsCooking () const
 
FORCEINLINE const ITargetPlatformCookingTarget () const
 
void SetCookData (FArchiveCookData *InCookData)
 
FArchiveCookDataGetCookData ()
 
FORCEINLINE FArchiveCookContextGetCookContext ()
 
virtual bool UseToResolveEnumerators () const
 
virtual bool ShouldSkipProperty (const FProperty *InProperty) const
 
virtual void SetSerializedProperty (FProperty *InProperty)
 
FORCEINLINE struct FPropertyGetSerializedProperty () const
 
void GetSerializedPropertyChain (TArray< struct FProperty * > &OutProperties) const
 
FORCEINLINE const FArchiveSerializedPropertyChainGetSerializedPropertyChain () const
 
virtual void SetSerializedPropertyChain (const FArchiveSerializedPropertyChain *InSerializedPropertyChain, struct FProperty *InSerializedPropertyOverride=nullptr)
 
virtual void SetSerializeContext (FUObjectSerializeContext *InLoadContext)
 
virtual FUObjectSerializeContextGetSerializeContext ()
 
virtual void Reset ()
 
virtual void SetIsLoading (bool bInIsLoading)
 
virtual void SetIsLoadingFromCookedPackage (bool bInIsLoadingFromCookedPackage)
 
virtual void SetIsSaving (bool bInIsSaving)
 
virtual void SetIsTransacting (bool bInIsTransacting)
 
virtual void SetIsTextFormat (bool bInIsTextFormat)
 
virtual void SetWantBinaryPropertySerialization (bool bInWantBinaryPropertySerialization)
 
virtual void SetUseUnversionedPropertySerialization (bool bInUseUnversioned)
 
virtual void SetForceUnicode (bool bInForceUnicode)
 
virtual void SetIsPersistent (bool bInIsPersistent)
 
virtual void SetUEVer (FPackageFileVersion InVer)
 
FORCEINLINE void SetUE4Ver (int32 InVer)
 
virtual void SetLicenseeUEVer (int32 InVer)
 
virtual void SetEngineVer (const FEngineVersionBase &InVer)
 
virtual void SetEngineNetVer (const uint32 InEngineNetVer)
 
virtual void SetGameNetVer (const uint32 InGameNetVer)
 
FORCEINLINE bool ShouldSkipCompilingAssets () const
 

Static Public Member Functions

static bool TryRegister (const TSharedPtr< FPreloadableFile > &PreloadableFile)
 
static FArchiveTryTakeArchive (const TCHAR *FileName)
 
static bool UnRegister (const TSharedPtr< FPreloadableFile > &PreloadableFile)
 

Static Private Attributes

static TMap< FString, TSharedPtr< FPreloadableFile > > RegisteredFiles
 

Additional Inherited Members

- Public Types inherited from FPreloadableArchive
enum  Flags {
  None = 0x0 , ModeBits = 0x1 , PreloadHandle = 0x0 , PreloadBytes = 0x1 ,
  Prime = 0x2
}
 
enum  { DefaultPrimeSize = 1024 , DefaultPageSize = 64*1024 }
 
typedef TUniqueFunction< FArchive *()> FCreateArchive
 
typedef TUniqueFunction< IAsyncReadFileHandle *()> FCreateAsyncArchive
 
- Public Attributes inherited from FArchive
FFastPathLoadBufferActiveFPLB
 
FFastPathLoadBuffer InlineFPLB
 
uint8 ArContainsCode: 1
 
uint8 ArContainsMap: 1
 
uint8 ArRequiresLocalizationGather: 1
 
uint8 ArForceByteSwapping: 1
 
uint8 ArIgnoreArchetypeRef: 1
 
uint8 ArNoDelta: 1
 
uint8 ArNoIntraPropertyDelta: 1
 
uint8 ArIgnoreOuterRef: 1
 
uint8 ArIgnoreClassGeneratedByRef: 1
 
uint8 ArIgnoreClassRef: 1
 
uint8 ArAllowLazyLoading: 1
 
uint8 ArIsObjectReferenceCollector: 1
 
uint8 ArIsModifyingWeakAndStrongReferences: 1
 
uint8 ArIsCountingMemory: 1
 
uint8 ArShouldSkipBulkData: 1
 
uint8 ArIsFilterEditorOnly: 1
 
uint8 ArIsSaveGame: 1
 
uint8 ArIsNetArchive: 1
 
uint8 ArUseCustomPropertyList: 1
 
int32 ArSerializingDefaults
 
uint32 ArPortFlags
 
int64 ArMaxSerializeSize
 
const struct FCustomPropertyListNodeArCustomPropertyList
 
- Protected Member Functions inherited from FPreloadableArchive
void InitializeInternalAsync (FCreateArchive &&InCreateArchiveFunction, FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 InFlags, int64 PrimeSize)
 
void InitializeInternal (FCreateArchive &&InCreateArchiveFunction, FCreateAsyncArchive &&InCreateAsyncArchiveFunction, uint32 Flags, int64 PrimeSize)
 
void PausePreload ()
 
void ResumePreload ()
 
bool ResumePreloadNonRecursive ()
 
void OnReadComplete (bool bCanceled, IAsyncReadRequest *ReadRequest)
 
void FreeRetiredRequests ()
 
void SerializeSynchronously (void *V, int64 Length)
 
- Protected Member Functions inherited from FArchive
void SetShouldSkipCompilingAssets (bool Enabled)
 
- Static Protected Member Functions inherited from FArchive
static void LinkProxy (FArchiveState &Inner, FArchiveState &Proxy)
 
static void UnlinkProxy (FArchiveState &Inner, FArchiveState &Proxy)
 
- Protected Attributes inherited from FPreloadableArchive
FString ArchiveName
 
int64 Pos = 0
 
int64 Size = -1
 
FEventPendingAsyncComplete = nullptr
 
TAtomic< boolbInitialized
 
TAtomic< boolbIsPreloading
 
TAtomic< boolbIsPreloadingPaused
 
uint8CacheBytes = nullptr
 
TAtomic< int64CacheEnd
 
TUniquePtr< IAsyncReadFileHandle > AsynchronousHandle
 
TUniquePtr< FArchiveSynchronousArchive
 
TArray< IAsyncReadRequest * > RetiredRequests
 
int64 PageSize = DefaultPageSize
 
FCriticalSection PreloadLock
 
bool bReadCompleteWasCalledInline = false
 
bool bIsInlineReadComplete = false
 
struct FPreloadableArchive::FSavedReadCompleteArguments SavedReadCompleteArguments
 

Detailed Description

An FPreloadableArchive that is customized for reading files from IFileManager.

This class also supports registration of instances of this class by filename, which other systems in the engine can use to request an FArchive for the preload file, if it exists, replacing a call they would otherwise make to IFileManager::Get().CreateFileReader.

As with the base class, the preloading can work in either PreloadBytes or PreloadHandle mode.

Activate PreloadBytes mode by passing Flags::PreloadBytes to InitializeAsync. Activate PreloadHandle mode by passing Flags::PreloadHandle to InitializeAsync, optionally or'd with Flags::Prime.

Definition at line 207 of file PreloadableFile.h.

Constructor & Destructor Documentation

◆ FPreloadableFile()

FPreloadableFile::FPreloadableFile ( FStringView FileName)

Member Function Documentation

◆ InitializeAsync()

void FPreloadableFile::InitializeAsync ( uint32 InFlags = Flags::None,
int64 PrimeSize = DefaultPrimeSize )

Initialize the FPreloadableFile asynchronously, performing FileOpen operations on another thread. Use IsInitialized or WaitForInitialization to check progress.

◆ TryRegister()

static bool FPreloadableFile::TryRegister ( const TSharedPtr< FPreloadableFile > & PreloadableFile)
static

Try to register the given FPreloadableFile instance to handle the next call to TryTakeArchive for its FileName. Will fail if the instance has not been initialized or if another instance has already registered for the Filename. Return whether the instance is currently registered. Returns true if the instance was already registered. Registered files are referenced-counted, and the reference will not be dropped until (1) (TryTakeArchive or UnRegister is called) and (2) (PreloadBytes mode only) the archive returned from TryTakeArchive is deleted.

◆ TryTakeArchive()

static FArchive * FPreloadableFile::TryTakeArchive ( const TCHAR * FileName)
static

Look up an FPreloadableFile instance registered for the given FileName, and return an FArchive from it. If found, removes the registration so no future call to TryTakeArchive can sue the same FArchive. If the instance is in PreloadHandle mode, the Lower-Level FArchive will be detached from the FPreloadableFile and returned using DetachLowerLevel. If the instance is in PreloadBytes mode, a ProxyArchive will be returned that forwards call to the FPreloadableFile instance.

◆ UnRegister()

static bool FPreloadableFile::UnRegister ( const TSharedPtr< FPreloadableFile > & PreloadableFile)
static

Remove the FPreloadableFile instance if it is registered for its FileName. Returns whether the instance was registered.

Member Data Documentation

◆ RegisteredFiles

TMap<FString, TSharedPtr<FPreloadableFile> > FPreloadableFile::RegisteredFiles
staticprivate

Map used for TryTakeArchive registration.

Definition at line 235 of file PreloadableFile.h.


The documentation for this class was generated from the following file: