Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::BufferAccessor Class Reference

Provides access to a region within a memory pool buffer. More...

#include <aeongames/BufferAccessor.hpp>

Collaboration diagram for AeonGames::BufferAccessor:
Collaboration graph

Public Member Functions

DLL BufferAccessor ()
 Default constructor.
DLL BufferAccessor (MemoryPoolBuffer *aMemoryPoolBuffer, size_t aOffset, size_t aSize)
 Construct an accessor for a specific region of a memory pool buffer.
DLL BufferAccessor (const BufferAccessor &)
 Copy constructor.
DLL BufferAccessor (BufferAccessor &&)
 Move constructor.
DLL BufferAccessoroperator= (const BufferAccessor &)
 Copy assignment operator.
DLL BufferAccessoroperator= (BufferAccessor &&)
 Move assignment operator.
DLL void WriteMemory (size_t aOffset, size_t aSize, const void *aData=nullptr) const
 Write data into the buffer region.
DLL void * Map (size_t aOffset=0, size_t aSize=0) const
 Map the buffer region into host-accessible memory.
DLL void Unmap () const
 Unmap a previously mapped buffer region.
DLL size_t GetOffset () const
 Get the byte offset of this accessor within the memory pool buffer.
DLL size_t GetSize () const
 Get the size of the accessible region.
DLL const MemoryPoolBufferGetMemoryPoolBuffer () const
 Get the underlying memory pool buffer.

Detailed Description

Provides access to a region within a memory pool buffer.

Definition at line 24 of file BufferAccessor.hpp.

Constructor & Destructor Documentation

◆ BufferAccessor() [1/2]

AeonGames::BufferAccessor::BufferAccessor ( )
default

Default constructor.

Creates an empty accessor.

◆ BufferAccessor() [2/2]

AeonGames::BufferAccessor::BufferAccessor ( MemoryPoolBuffer * aMemoryPoolBuffer,
size_t aOffset,
size_t aSize )

Construct an accessor for a specific region of a memory pool buffer.

Parameters
aMemoryPoolBufferPointer to the memory pool buffer.
aOffsetByte offset into the buffer.
aSizeSize of the accessible region in bytes.

Definition at line 23 of file BufferAccessor.cpp.

Member Function Documentation

◆ GetMemoryPoolBuffer()

const MemoryPoolBuffer * AeonGames::BufferAccessor::GetMemoryPoolBuffer ( ) const

Get the underlying memory pool buffer.

Returns
Pointer to the memory pool buffer.

Definition at line 60 of file BufferAccessor.cpp.

◆ GetOffset()

size_t AeonGames::BufferAccessor::GetOffset ( ) const

Get the byte offset of this accessor within the memory pool buffer.

Returns
Offset in bytes.

Definition at line 52 of file BufferAccessor.cpp.

◆ GetSize()

size_t AeonGames::BufferAccessor::GetSize ( ) const

Get the size of the accessible region.

Returns
Size in bytes.

Definition at line 56 of file BufferAccessor.cpp.

◆ Map()

void * AeonGames::BufferAccessor::Map ( size_t aOffset = 0,
size_t aSize = 0 ) const

Map the buffer region into host-accessible memory.

Parameters
aOffsetByte offset relative to the accessor's region.
aSizeSize of the region to map (0 for entire region).
Returns
Pointer to the mapped memory.

Definition at line 40 of file BufferAccessor.cpp.

◆ Unmap()

void AeonGames::BufferAccessor::Unmap ( ) const

Unmap a previously mapped buffer region.

Definition at line 45 of file BufferAccessor.cpp.

◆ WriteMemory()

void AeonGames::BufferAccessor::WriteMemory ( size_t aOffset,
size_t aSize,
const void * aData = nullptr ) const

Write data into the buffer region.

Parameters
aOffsetByte offset relative to the accessor's region.
aSizeSize of the data to write in bytes.
aDataPointer to the source data, or nullptr to zero-fill.

Definition at line 33 of file BufferAccessor.cpp.


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