Class MemoryMap

Class Documentation

class MemoryMap

C++ abstraction of mmap and munmap. When a MemoryMap object is created the configured memory is mapped into the process space until that object goes out of scope - then munmap is called and the memory region is removed from the process space.

Public Functions

MemoryMap(const MemoryMap&) = delete

copy operations are removed since we are handling a system resource

MemoryMap &operator=(const MemoryMap&) = delete
MemoryMap(MemoryMap &&rhs) noexcept

move constructor

Parameters:

rhs[in] the source object

MemoryMap &operator=(MemoryMap &&rhs) noexcept

move assignment operator

Parameters:

rhs[in] the source object

Returns:

reference to *this

~MemoryMap() noexcept

destructor, calls munmap when the underlying memory is mapped

const void *getBaseAddress() const noexcept

returns the base address, if the object was moved it returns nullptr

void *getBaseAddress() noexcept

returns the base address, if the object was moved it returns nullptr

Friends

friend class MemoryMapBuilder