10#ifndef OKSSYSTEM_MAP_FILE
11#define OKSSYSTEM_MAP_FILE
File descriptor / Socket wrapper.
Wrapper for file operations.
mode_t permissions() const
permissions for the file */
size_t size() const
size of file */
Wrapper for memory map operations.
void unmap_mem()
unmaps the file into memory
static const char *const MAP_NOT_LOAD_MSG
message pattern - map is not loaded
void * m_map_address
the address of the map in memory
void zero() const
builds a zeroed file with correct length
size_t m_map_offset
offset in the file of the map
size_t m_map_size
the size of the map
MapFile(const std::string &file, size_t size, size_t offset, bool read_mode, bool write_mode, mode_t permissions=0666)
bool is_mapped() const
is the file mopped im memory
bool m_map_write
is the map writable
void unmap()
unmaps the file
static const char *const MAP_LOAD_MSG
message pattern - map is loaded
static const char *const READ_OR_WRITE_MSG
message pattern - map mode is neither read nor write
Descriptor * m_map_descriptor
internal file descriptor
bool m_is_mapped
is the file mapped in memory
bool is_loaded() const
is the map loaded in memory
static const char *const PAGE_SIZE_MSG
message pattern - illegal page size
OksSystem::Descriptor * fd() const
the file descriptor. This method returns a valid pointer only if called after map().
void open_fd()
opens the file descriptor for the map
void close_fd()
closes the file descriptor for the map
size_t memory_size() const
the size of the map
void map_mem()
maps the file into memory
bool m_map_read
is the map readable
void map()
maps the file in memory
mode_t m_map_permission
permissions associated with the file
static const char *const MAP_NOT_WRITE_MSG
message pattern - map is not writable
void * address() const
the address of the memory mapped file