Skip to content

AmAlignedReal32Buffer

class AmAlignedReal32Buffer

Class that handles aligned allocations to support vectorized operations.

Operators

Name Description
operator[] Returns a reference to the float at the specified index.
operator[] Returns a const reference to the float at the specified index.

Functions

Name Description
AmAlignedReal32Buffer Constructs an empty buffer.
~AmAlignedReal32Buffer Destructs the buffer and deallocates the memory.
Init Allocates and align buffer.
Clear Clears all data.
Release Releases the allocated buffer.
GetSize Gets the size of the buffer.
GetBuffer Gets the current aligned pointer.
GetPointer Gets the raw allocated pointer.
CopyFrom Copies data from another buffer.
Resize Resizes the buffer to the specified size.
Swap Swaps two buffers.

Operator Details

operator[]

AmReal32& operator

Returns a reference to the float at the specified index.

Parameter index
The index of the float to retrieve.
Return
The reference to the float at the specified index.

const AmReal32& operator const

Returns a const reference to the float at the specified index.

Parameter index
The index of the float to retrieve.
Return
The const reference to the float at the specified index.

Function Details

AmAlignedReal32Buffer

AmAlignedReal32Buffer()

Constructs an empty buffer.

Clear

void Clear() const

Clears all data.

CopyFrom

void CopyFrom(const AmAlignedReal32Buffer& other) const

Copies data from another buffer.

Parameter other
The other buffer to copy data from.

GetBuffer

[[nodiscard]] inline AmReal32* GetBuffer() const

Gets the current aligned pointer.

Return
The pointer the float buffer

GetPointer

[[nodiscard]] inline AmUInt8Buffer GetPointer() const

Gets the raw allocated pointer.

Return
The pointer to the raw allocated memory.

GetSize

[[nodiscard]] inline AmUInt32 GetSize() const

Gets the size of the buffer.

Return
The number of float values stored in the buffer.

Init

AmResult Init(AmUInt32 size, bool clear = true)

Allocates and align buffer.

Parameter size
The buffer size.
Parameter clear
Whether to clear the buffer.
Return
An AM_ERROR value indicating if the allocation was successful or not.

Release

void Release()

Releases the allocated buffer.

Resize

void Resize(AmUInt32 size, bool clear = true)

Resizes the buffer to the specified size.

Parameter size
The new size of the buffer.
Parameter clear
Whether to clear the buffer after resize. If true, the buffer will be cleared even if the new size equals the old size.

Swap

static void Swap(AmAlignedReal32Buffer& a, AmAlignedReal32Buffer& b)

Swaps two buffers.

Parameter a
The first buffer.
Parameter b
The second buffer.

~AmAlignedReal32Buffer

~AmAlignedReal32Buffer()

Destructs the buffer and deallocates the memory.