1#include <Foundation/FoundationPCH.h>
2PL_FOUNDATION_INTERNAL_HEADER
4#include <Foundation/IO/MemoryMappedFile.h>
5#include <Foundation/Logging/Log.h>
6#include <Foundation/Strings/PathUtils.h>
11 void* m_pMappedFilePtr =
nullptr;
12 plUInt64 m_uiFileSize = 0;
17plMemoryMappedFile::plMemoryMappedFile()
22plMemoryMappedFile::~plMemoryMappedFile()
34 return m_pImpl->m_Mode;
39 PL_ASSERT_DEBUG(m_pImpl->m_Mode >=
Mode::ReadOnly,
"File must be opened with read access before accessing it for reading.");
40 return m_pImpl->m_pMappedFilePtr;
45 PL_ASSERT_DEBUG(m_pImpl->m_Mode >=
Mode::ReadWrite,
"File must be opened with read/write access before accessing it for writing.");
46 return m_pImpl->m_pMappedFilePtr;
51 return m_pImpl->m_uiFileSize;
OffsetBase
The start point for interpreting byte offsets into the memory.
Definition MemoryMappedFile.h:25
void Close()
Removes the memory mapping. Outstanding modifications will be written back to disk at this point.
Definition MemoryMappedFile_NoImpl.h:27
const void * GetReadPointer(plUInt64 uiOffset=0, OffsetBase base=OffsetBase::Start) const
Returns a pointer for reading the mapped file. Asserts that the memory mapping was done successfully.
Definition MemoryMappedFile_NoImpl.h:37
Mode
Definition MemoryMappedFile.h:17
@ ReadOnly
File is mapped for read-only access.
@ None
Currently no file is mapped.
@ ReadWrite
File is mapped for read/write access.
void * GetWritePointer(plUInt64 uiOffset=0, OffsetBase base=OffsetBase::Start)
Returns a pointer for writing the mapped file. Asserts that the memory mapping was successful and the...
Definition MemoryMappedFile_NoImpl.h:43
Mode GetMode() const
Returns the mode with which the file was opened or None, if is currently not in use.
Definition MemoryMappedFile_NoImpl.h:32
plUInt64 GetFileSize() const
Returns the size (in bytes) of the memory mapping. Zero if no file is mapped at the moment.
Definition MemoryMappedFile_NoImpl.h:49
Definition MemoryMappedFile_NoImpl.h:9