Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::MemoryMappedFile Class Reference

Basic cross-platform abstraction for memory mapped files. More...

#include <mitsuba/core/mmap.h>

+ Inheritance diagram for mitsuba::MemoryMappedFile:

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 ClassgetClass () 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< MemoryMappedFilecreateTemporary (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 Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_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...
 

Detailed Description

Basic cross-platform abstraction for memory mapped files.

Constructor & Destructor Documentation

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.

mitsuba::MemoryMappedFile::MemoryMappedFile ( )
protected

Internal constructor.

virtual mitsuba::MemoryMappedFile::~MemoryMappedFile ( )
protectedvirtual

Release all resources.

Member Function Documentation

static ref<MemoryMappedFile> mitsuba::MemoryMappedFile::createTemporary ( size_t  size)
static

Create a temporary memory-mapped file.

Remarks
When closing the mapping, the file is automatically deleted.
virtual const Class* mitsuba::MemoryMappedFile::getClass ( ) const
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()

std::string mitsuba::MemoryMappedFile::toString ( ) const
virtual

Return a string representation.

Reimplemented from Object.

Member Data Documentation

Class* mitsuba::MemoryMappedFile::m_theClass
static

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