Navigation
Unreal Engine C++ API Reference > Runtime > Core > Memory
Inheritance Hierarchy
- FBufferOwner
- TBufferOwnerDeleteFunction
- TBufferOwnerTArray
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Memory/SharedBuffer.h |
Include | #include "Memory/SharedBuffer.h" |
Syntax
class FBufferOwner
Remarks
A reference-counted owner for a buffer, which is a raw pointer and size.
A buffer owner may own its memory or provide a view into memory owned externally. When used as a non-owning view, the viewed memory must be guaranteed to outlive the buffer owner. When this lifetime guarantee cannot be satisfied, MakeOwned may be called on the reference to the buffer to clone into a new buffer owner that owns the memory.
A buffer owner must be referenced and accessed through one of its three reference types: FUniqueBuffer, FSharedBuffer, or FWeakSharedBuffer.
FUniqueBuffer and FSharedBuffer offer static functions to create a buffer using private buffer owner types that are ideal for most use cases. The TakeOwnership function allows creation of a buffer with a custom delete function. Advanced use cases require deriving from FBufferOwner to enable storage of arbitrary members alongside the data and size, and to enable materialization of the buffer to be deferred.
A derived type must call SetIsOwned from its constructor if they own (or will own) the buffer. A derived type must call SetIsImmutable from its constructor if they want the buffer to become permanently immutable after it is stored in FSharedBuffer, forcing MoveToUnique() to clone it. A derived type must call SetIsMaterialized from its constructor, unless it implements deferred materialization by overriding MaterializeBuffer.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
FBufferOwner () |
||
![]() |
FBufferOwner
(
const FBufferOwner& |
||
![]() |
FBufferOwner
(
void* InData, |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | FreeBuffer () |
Free the buffer and any associated resources. |
![]() |
void * | GetData () |
|
![]() |
uint64 | GetSize () |
|
![]() ![]() |
uint32 | ||
![]() ![]() |
bool | IsImmutable () |
|
![]() ![]() |
bool | ||
![]() ![]() |
bool | IsOwned () |
|
![]() |
void | Materialize () |
|
![]() ![]() |
void | Materialize the buffer by making it ready to be accessed. | |
![]() |
void | SetBuffer
(
void* InData, |
|
![]() |
void | ||
![]() |
void | ||
![]() |
void | SetIsOwned () |
Operators
Type | Name | Description | |
---|---|---|---|
![]() |
FBufferOwner & | operator=
(
const FBufferOwner& |
Enums
Type | Name | Description | |
---|---|---|---|
![]() |
EBufferOwnerFlags |
Constants
Name | Description |
---|---|
RefCountMask |