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

#include <IPlatformFileCachedWrapper.h>

+ Inheritance diagram for FCachedFileHandle:
+ Collaboration diagram for FCachedFileHandle:

Public Member Functions

 FCachedFileHandle (IFileHandle *InFileHandle, bool bInReadable, bool bInWritable)
 
virtual ~FCachedFileHandle ()
 
virtual int64 Tell () override
 
virtual bool Seek (int64 NewPosition) override
 
virtual bool SeekFromEnd (int64 NewPositionRelativeToEnd=0) override
 
virtual bool Read (uint8 *Destination, int64 BytesToRead) override
 
virtual bool Write (const uint8 *Source, int64 BytesToWrite) override
 
virtual int64 Size () override
 
virtual bool Flush (const bool bFullFlush=false) override
 
virtual bool Truncate (int64 NewSize) override
 
virtual void ShrinkBuffers () override
 
- Public Member Functions inherited from IFileHandle
virtual ~IFileHandle ()
 

Private Member Functions

bool InnerSeek (uint64 Pos)
 
bool InnerRead (uint8 *Dest, uint64 BytesToRead)
 
int32 GetCacheIndex (int64 Pos) const
 
void FlushCache ()
 

Private Attributes

TUniquePtr< IFileHandleFileHandle
 
int64 FilePos
 
int64 TellPos
 
int64 FileSize
 
bool bWritable
 
bool bReadable
 
uint8 BufferCache [CacheCount][BufferCacheSize]
 
int64 CacheStart [CacheCount]
 
int64 CacheEnd [CacheCount]
 
int32 CurrentCache
 

Static Private Attributes

static constexpr uint32 BufferCacheSize = 64 * 1024
 
static constexpr uint64 BufferSizeMask = ~((uint64)BufferCacheSize-1)
 
static constexpr uint32 CacheCount = 2
 

Detailed Description

Definition at line 21 of file IPlatformFileCachedWrapper.h.

Constructor & Destructor Documentation

◆ FCachedFileHandle()

FCachedFileHandle::FCachedFileHandle ( IFileHandle * InFileHandle,
bool bInReadable,
bool bInWritable )
inline

Definition at line 24 of file IPlatformFileCachedWrapper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~FCachedFileHandle()

virtual FCachedFileHandle::~FCachedFileHandle ( )
inlinevirtual

Definition at line 36 of file IPlatformFileCachedWrapper.h.

Member Function Documentation

◆ Flush()

virtual bool FCachedFileHandle::Flush ( const bool bFullFlush = false)
inlineoverridevirtual

Flushes file handle to disk.

Parameters
bFullFlushtrue to flush everything about the file (including its meta-data) with a strong guarantee that it will be on disk by the time this function returns, or false to let the operating/file system have more leeway about when the data actually gets written to disk
Returns
true if operation completed successfully.

Implements IFileHandle.

Definition at line 167 of file IPlatformFileCachedWrapper.h.

◆ FlushCache()

void FCachedFileHandle::FlushCache ( )
inlineprivate

Definition at line 235 of file IPlatformFileCachedWrapper.h.

+ Here is the caller graph for this function:

◆ GetCacheIndex()

int32 FCachedFileHandle::GetCacheIndex ( int64 Pos) const
inlineprivate

Definition at line 224 of file IPlatformFileCachedWrapper.h.

+ Here is the caller graph for this function:

◆ InnerRead()

bool FCachedFileHandle::InnerRead ( uint8 * Dest,
uint64 BytesToRead )
inlineprivate

Definition at line 215 of file IPlatformFileCachedWrapper.h.

+ Here is the caller graph for this function:

◆ InnerSeek()

bool FCachedFileHandle::InnerSeek ( uint64 Pos)
inlineprivate

Definition at line 202 of file IPlatformFileCachedWrapper.h.

+ Here is the caller graph for this function:

◆ Read()

virtual bool FCachedFileHandle::Read ( uint8 * Destination,
int64 BytesToRead )
inlineoverridevirtual

Read bytes from the file.

Parameters
DestinationBuffer to holds the results, should be at least BytesToRead in size.
BytesToReadNumber of bytes to read into the destination.
Returns
true if the operation completed successfully.

Implements IFileHandle.

Definition at line 61 of file IPlatformFileCachedWrapper.h.

+ Here is the call graph for this function:

◆ Seek()

virtual bool FCachedFileHandle::Seek ( int64 NewPosition)
inlineoverridevirtual

Change the current write or read position.

Parameters
NewPositionnew write or read position
Returns
true if the operation completed successfully.

Implements IFileHandle.

Definition at line 46 of file IPlatformFileCachedWrapper.h.

+ Here is the caller graph for this function:

◆ SeekFromEnd()

virtual bool FCachedFileHandle::SeekFromEnd ( int64 NewPositionRelativeToEnd = 0)
inlineoverridevirtual

Change the current write or read position, relative to the end of the file.

Parameters
NewPositionRelativeToEndnew write or read position, relative to the end of the file should be <=0!
Returns
true if the operation completed successfully.

Implements IFileHandle.

Definition at line 56 of file IPlatformFileCachedWrapper.h.

+ Here is the call graph for this function:

◆ ShrinkBuffers()

virtual void FCachedFileHandle::ShrinkBuffers ( )
inlineoverridevirtual

Minimizes optional system or process cache kept for the file.

Reimplemented from IFileHandle.

Definition at line 191 of file IPlatformFileCachedWrapper.h.

◆ Size()

virtual int64 FCachedFileHandle::Size ( )
inlineoverridevirtual

Return the total size of the file

Reimplemented from IFileHandle.

Definition at line 162 of file IPlatformFileCachedWrapper.h.

◆ Tell()

virtual int64 FCachedFileHandle::Tell ( )
inlineoverridevirtual

Return the current write or read position.

Implements IFileHandle.

Definition at line 41 of file IPlatformFileCachedWrapper.h.

◆ Truncate()

virtual bool FCachedFileHandle::Truncate ( int64 NewSize)
inlineoverridevirtual

Truncate the file to the given size (in bytes).

Parameters
NewSizeTruncated file size (in bytes).
Returns
true if the operation completed successfully.

Implements IFileHandle.

Definition at line 176 of file IPlatformFileCachedWrapper.h.

+ Here is the call graph for this function:

◆ Write()

virtual bool FCachedFileHandle::Write ( const uint8 * Source,
int64 BytesToWrite )
inlineoverridevirtual

Write bytes to the file.

Parameters
SourceBuffer to write, should be at least BytesToWrite in size.
BytesToWriteNumber of bytes to write.
Returns
true if the operation completed successfully.

Implements IFileHandle.

Definition at line 138 of file IPlatformFileCachedWrapper.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ bReadable

bool FCachedFileHandle::bReadable
private

Definition at line 248 of file IPlatformFileCachedWrapper.h.

◆ BufferCache

uint8 FCachedFileHandle::BufferCache[CacheCount][BufferCacheSize]
private

Definition at line 249 of file IPlatformFileCachedWrapper.h.

◆ BufferCacheSize

constexpr uint32 FCachedFileHandle::BufferCacheSize = 64 * 1024
staticconstexprprivate

Definition at line 198 of file IPlatformFileCachedWrapper.h.

◆ BufferSizeMask

constexpr uint64 FCachedFileHandle::BufferSizeMask = ~((uint64)BufferCacheSize-1)
staticconstexprprivate

Definition at line 199 of file IPlatformFileCachedWrapper.h.

◆ bWritable

bool FCachedFileHandle::bWritable
private

Definition at line 247 of file IPlatformFileCachedWrapper.h.

◆ CacheCount

constexpr uint32 FCachedFileHandle::CacheCount = 2
staticconstexprprivate

Definition at line 200 of file IPlatformFileCachedWrapper.h.

◆ CacheEnd

int64 FCachedFileHandle::CacheEnd[CacheCount]
private

Definition at line 251 of file IPlatformFileCachedWrapper.h.

◆ CacheStart

int64 FCachedFileHandle::CacheStart[CacheCount]
private

Definition at line 250 of file IPlatformFileCachedWrapper.h.

◆ CurrentCache

int32 FCachedFileHandle::CurrentCache
private

Definition at line 252 of file IPlatformFileCachedWrapper.h.

◆ FileHandle

TUniquePtr<IFileHandle> FCachedFileHandle::FileHandle
private

Definition at line 243 of file IPlatformFileCachedWrapper.h.

◆ FilePos

int64 FCachedFileHandle::FilePos
private

Definition at line 244 of file IPlatformFileCachedWrapper.h.

◆ FileSize

int64 FCachedFileHandle::FileSize
private

Definition at line 246 of file IPlatformFileCachedWrapper.h.

◆ TellPos

int64 FCachedFileHandle::TellPos
private

Definition at line 245 of file IPlatformFileCachedWrapper.h.


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