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 Types
Public Functions
-
MmapReader() noexcept#
Default constructor.
- explicit MmapReader( )#
Construct and load file.
- Parameters:
fp – Path to file to load
mode – Mapping protection and sharing mode
- 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( )#
Load and memory-map a file.
- Parameters:
fp – Path to file to load
mode – Mapping protection and sharing mode
- 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
-
MmapReader() noexcept#