MMAP Reader#

class MmapReader#

Memory-mapped file reader.

Provides efficient file reading using memory mapping (mmap). The file contents are mapped directly into memory without copying.

Public Functions

MmapReader() noexcept#

Default constructor.

explicit MmapReader(std::filesystem::path const &fp)#

Construct and load file.

Parameters:

fp – Path to file to load

Throws:

std::runtime_error – If file cannot be loaded

MmapReader(MmapReader const&) = delete#

Deleted copy constructor.

MmapReader &operator=(MmapReader const&) = delete#

Deleted copy assignment operator.

~MmapReader() noexcept#

Destructor.

void release() noexcept#

Release mapped memory.

bool loadFile(std::filesystem::path const &fp)#

Load and memory-map a file.

Parameters:

fp – Path to file to load

Returns:

True on success, false on failure

int8_t const *getByteData() const noexcept#

Get mapped data as byte array.

Returns:

Const pointer to byte data

void const *getData() const noexcept#

Get mapped data as void pointer.

Returns:

Const pointer to data

size_t getSize() const noexcept#

Get size of mapped data.

Returns:

Size in bytes