Basic cross-platform abstraction for memory mapped files. More...
#include <mitsuba/core/mmap.h>
Public Member Functions | |
MemoryMappedFile (const fs::path &filename, size_t size) | |
Create a new memory-mapped file of the specified size. More... | |
MemoryMappedFile (const fs::path &filename, bool readOnly=true) | |
Map the specified file into memory. More... | |
void * | getData () |
Return a pointer to the file contents in memory. More... | |
const void * | getData () const |
Return a pointer to the file contents in memory (const version) More... | |
size_t | getSize () const |
Return the size of the mapped region. More... | |
void | resize (size_t size) |
Resize the memory-mapped file. More... | |
const fs::path & | getFilename () const |
Return the associated filename. More... | |
bool | isReadOnly () const |
Return whether the mapped memory region is read-only. More... | |
std::string | toString () const |
Return a string representation. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
Static Public Member Functions | |
static ref< MemoryMappedFile > | createTemporary (size_t size) |
Create a temporary memory-mapped file. More... | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
MemoryMappedFile () | |
Internal constructor. More... | |
virtual | ~MemoryMappedFile () |
Release all resources. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Basic cross-platform abstraction for memory mapped files.
mitsuba::MemoryMappedFile::MemoryMappedFile | ( | const fs::path & | filename, |
size_t | size | ||
) |
Create a new memory-mapped file of the specified size.
mitsuba::MemoryMappedFile::MemoryMappedFile | ( | const fs::path & | filename, |
bool | readOnly = true |
||
) |
Map the specified file into memory.
|
protected |
Internal constructor.
|
protectedvirtual |
Release all resources.
|
static |
Create a temporary memory-mapped file.
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
void* mitsuba::MemoryMappedFile::getData | ( | ) |
Return a pointer to the file contents in memory.
const void* mitsuba::MemoryMappedFile::getData | ( | ) | const |
Return a pointer to the file contents in memory (const version)
const fs::path& mitsuba::MemoryMappedFile::getFilename | ( | ) | const |
Return the associated filename.
size_t mitsuba::MemoryMappedFile::getSize | ( | ) | const |
Return the size of the mapped region.
bool mitsuba::MemoryMappedFile::isReadOnly | ( | ) | const |
Return whether the mapped memory region is read-only.
void mitsuba::MemoryMappedFile::resize | ( | size_t | size | ) |
Resize the memory-mapped file.
This involves remapping the file, which will generally change the pointer obtained via getData()
|
virtual |
Return a string representation.
Reimplemented from Object.
|
static |