Lunchbox  1.8.0
Public Member Functions | List of all members
lunchbox::MemoryMap Class Reference

Helper to map a file to a memory address (mmap) More...

#include <memoryMap.h>

+ Inheritance diagram for lunchbox::MemoryMap:
+ Collaboration diagram for lunchbox::MemoryMap:

Public Member Functions

 MemoryMap ()
 Construct a new memory map.
 MemoryMap (const std::string &filename)
 Construct and initialize a new memory map.
 ~MemoryMap ()
 Destruct the memory map.
const void * map (const std::string &filename)
 Map a file to a memory address.
void unmap ()
 Unmap the file.
const void * getAddress () const
size_t getSize () const

Detailed Description

Helper to map a file to a memory address (mmap)

Definition at line 30 of file memoryMap.h.

Constructor & Destructor Documentation

lunchbox::MemoryMap::MemoryMap ( )

Construct a new memory map.

Version
1.0
lunchbox::MemoryMap::MemoryMap ( const std::string &  filename)

Construct and initialize a new memory map.

Version
1.7.1
lunchbox::MemoryMap::~MemoryMap ( )

Destruct the memory map.

Unmaps the file, if it is still mapped.

See Also
unmap()
Version
1.0

Member Function Documentation

const void* lunchbox::MemoryMap::getAddress ( ) const
inline
Returns
the pointer to the memory map.
Version
1.0

Definition at line 64 of file memoryMap.h.

size_t lunchbox::MemoryMap::getSize ( ) const
inline
Returns
the size of the memory map.
Version
1.0

Definition at line 67 of file memoryMap.h.

const void* lunchbox::MemoryMap::map ( const std::string &  filename)

Map a file to a memory address.

Currently the file is only mapped read-only. The file is automatically unmapped when the memory map is deleted.

Parameters
filenameThe filename of the file to map.
Returns
the pointer to the mapped file, or 0 upon error.
Version
1.0
void lunchbox::MemoryMap::unmap ( )

Unmap the file.

Version
1.0

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