Skip to content

FMjShmRegion

Owning wrapper around a file-backed mmap region.

Lifetime: Open() truncates / creates the file, mmaps the full size, and writes the initial FMjShmHeader. Close() unmaps and (optionally) deletes the file. Move-only; no copies. Thread safety: GetData() returns a raw pointer that is valid until Close() is called. Concurrent reads / writes through that pointer are the caller's responsibility (the publisher uses the double-buffer pattern below).

Attribute Value
Kind Class

Properties

Public Properties

Property Type Description
default ``
delete ``
operator FMjShmRegion&
size * * Total mapped
const ``
FilePath private: FString

default

  • Type:

delete

  • Type:

operator

size

  • Type: * * Total mapped

const

  • Type:

FilePath

  • Type: private: FString

Private Properties

Property Type Description
MappedAddr void*
MappedSize uint64
BufferStride uint32
NumBuffers uint32
PlatformFileHandle void*
HANDLE Win:
PlatformMappingHandle void*
HANDLE Win:

MappedAddr

  • Type: void*

MappedSize

  • Type: uint64

BufferStride

  • Type: uint32

NumBuffers

  • Type: uint32

PlatformFileHandle

  • Type: void*

HANDLE

  • Type: Win:

PlatformMappingHandle

  • Type: void*

HANDLE

  • Type: Win:

Functions

Public Functions

General

Function Returns Description
Open() bool Create / truncate the file at Path, mmap header + n_buffers slots,
Close() void Unmap, close handles, optionally remove the backing file.
GetData() void* Pointer to the start of the mapped region (header lives at offset 0).
GetSlot() uint8* Pointer to buffer slot index Idx (0 .. NBuffers-1).
Open

Create / truncate the file at Path, mmap header + n_buffers slots,

  • Signature: Open(const FString& Path, uint32 BufferStride, uint32 NBuffers)
  • Returns: bool
Close

Unmap, close handles, optionally remove the backing file.

  • Signature: Close(bool bDeleteFile)
GetData

Pointer to the start of the mapped region (header lives at offset 0).

  • Signature: GetData()
  • Returns: void*
GetSlot

Pointer to buffer slot index Idx (0 .. NBuffers-1).

  • Signature: GetSlot(uint32 Idx)
  • Returns: uint8*