Base Framework
Classes | Public Member Functions | Static Public Member Functions | List of all members
MappedFile Class Reference

File region mapper. More...

#include <base/io/MappedFile.h>

Inherits Object.

Public Member Functions

 MappedFile (const File &file, const FileRegion &region, bool writeable=false)
 
 MappedFile (const MappedFile &copy) noexcept
 
MappedFileoperator= (const MappedFile &assign) noexcept
 
uint8 * getBytes () const noexcept
 
const FileRegiongetRegion () const noexcept
 
void synchronize ()
 
void remap (const FileRegion &region)
 

Static Public Member Functions

static unsigned int getGranularity () noexcept
 

Detailed Description

File region mapper.

This class is used to map a specified file region into the address space of the process.

Version
1.1

Constructor & Destructor Documentation

◆ MappedFile() [1/2]

MappedFile::MappedFile ( const File file,
const FileRegion region,
bool  writeable = false 
)

Initializes a file mapping.

Parameters
fileThe file to be mapped into memory.
regionThe file region to be mapped. The offset of the region must honour the granularity returned by getGranularity.
writeableSpecifies that write access is required. Default is false.

◆ MappedFile() [2/2]

MappedFile::MappedFile ( const MappedFile copy)
inlinenoexcept

Initializes mapping from other mapping.

Member Function Documentation

◆ getBytes()

uint8* MappedFile::getBytes ( ) const
inlinenoexcept

Returns the mapped bytes. Do not use the mapping outside the requested mapping range.

◆ getGranularity()

static unsigned int MappedFile::getGranularity ( )
staticnoexcept

Returns the required granularity of the file region offset.

◆ getRegion()

const FileRegion& MappedFile::getRegion ( ) const
inlinenoexcept

Returns the mapped file region.

◆ operator=()

MappedFile& MappedFile::operator= ( const MappedFile assign)
noexcept

Assignment of mapping by mapping.

◆ remap()

void MappedFile::remap ( const FileRegion region)
inline

Maps the specified file region.

Parameters
regionThe file region to be mapped.

◆ synchronize()

void MappedFile::synchronize ( )
inline

Flushes the mapping.