![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Low-level memory-mapped file handle. More...
#include <mmap_reader.hpp>
Public Member Functions | |
| const uint8_t * | data () const |
| Pointer to the start of the mapped file. | |
| size_t | size () const |
| Total file size in bytes. | |
| const uint8_t * | data_at (size_t offset) const |
| Pointer to mapped memory at a given offset. | |
| void | close () |
| Unmap the file and close the file descriptor. | |
| ~MmapReader () | |
| Destructor – unmaps file and closes fd. | |
| MmapReader (const MmapReader &)=delete | |
| Non-copyable. | |
| MmapReader & | operator= (const MmapReader &)=delete |
| Non-copyable. | |
| MmapReader (MmapReader &&other) noexcept | |
| Move constructor – transfers ownership of the mapping. | |
| MmapReader & | operator= (MmapReader &&other) noexcept |
| Move assignment – transfers ownership of the mapping. | |
| bool | is_open () const |
| Returns true if the mapping is currently active. | |
| MmapReader ()=default | |
| Default constructor — creates a closed/unmapped reader. | |
Static Public Member Functions | |
| static expected< MmapReader > | open (const std::filesystem::path &path) |
| Open a file and memory-map it read-only. | |
Low-level memory-mapped file handle.
RAII wrapper around POSIX mmap(2). Opens a file in read-only mode, maps it entirely into memory, and unmaps on destruction (or explicit close()). Non-copyable, movable.
Definition at line 82 of file mmap_reader.hpp.
|
inline |
Destructor – unmaps file and closes fd.
Definition at line 188 of file mmap_reader.hpp.
|
delete |
Non-copyable.
|
inlinenoexcept |
Move constructor – transfers ownership of the mapping.
Definition at line 198 of file mmap_reader.hpp.
|
default |
Default constructor — creates a closed/unmapped reader.
|
inline |
Unmap the file and close the file descriptor.
Safe to call multiple times; subsequent calls are no-ops.
Definition at line 175 of file mmap_reader.hpp.
|
inline |
Pointer to the start of the mapped file.
Definition at line 153 of file mmap_reader.hpp.
|
inline |
Pointer to mapped memory at a given offset.
Returns nullptr if offset is out of bounds.
Definition at line 163 of file mmap_reader.hpp.
|
inline |
Returns true if the mapping is currently active.
Definition at line 223 of file mmap_reader.hpp.
|
inlinestatic |
Open a file and memory-map it read-only.
On success, returns an active MmapReader whose data() points to the mapped file contents. Applies MADV_SEQUENTIAL if available.
| path | Filesystem path to the file to map. |
Definition at line 91 of file mmap_reader.hpp.
|
delete |
Non-copyable.
|
inlinenoexcept |
Move assignment – transfers ownership of the mapping.
Definition at line 209 of file mmap_reader.hpp.
|
inline |
Total file size in bytes.
Definition at line 158 of file mmap_reader.hpp.