ReXGlue SDK
Loading...
Searching...
No Matches
rex::memory::ChunkedMappedMemoryWriter Class Referenceabstract

#include <rex/memory/virtual_memory.h>

Public Member Functions

virtual u8 * Allocate (size_t length)=0
virtual void Flush ()=0
virtual void FlushNew ()=0

Static Public Member Functions

static std::unique_ptr< ChunkedMappedMemoryWriter > Open (const std::filesystem::path &path, size_t chunk_size, bool low_address_space=false)

Protected Member Functions

 ChunkedMappedMemoryWriter (const std::filesystem::path &path, size_t chunk_size, bool low_address_space)

Protected Attributes

std::filesystem::path path_
size_t chunk_size_
bool low_address_space_

Detailed Description

Append only writer over fixed size mapped files named path.N.

Constructor & Destructor Documentation

◆ ChunkedMappedMemoryWriter()

rex::memory::ChunkedMappedMemoryWriter::ChunkedMappedMemoryWriter ( const std::filesystem::path & path,
size_t chunk_size,
bool low_address_space )
inlineprotected

Stores the writer settings.

Parameters
low_address_spaceTrue to map chunks below 4 GiB.

Member Function Documentation

◆ Allocate()

virtual u8 * rex::memory::ChunkedMappedMemoryWriter::Allocate ( size_t length)
pure virtual

Reserves space in the current chunk, opening a new chunk when it is full.

Parameters
lengthByte count, no larger than the chunk size.
Returns
Pointer to the reserved space, or null on failure.

◆ FlushNew()

virtual void rex::memory::ChunkedMappedMemoryWriter::FlushNew ( )
pure virtual

Writes the data added since the last FlushNew back to the files.

◆ Open()

std::unique_ptr< ChunkedMappedMemoryWriter > rex::memory::ChunkedMappedMemoryWriter::Open ( const std::filesystem::path & path,
size_t chunk_size,
bool low_address_space = false )
static

Creates a writer.

Parameters
chunk_sizeByte size of each chunk, rounded up to the allocation granularity.
low_address_spaceTrue to map chunks below 4 GiB, which Allocate refuses on macOS.

The documentation for this class was generated from the following file: