FEntityAllocation

[FEntityAllocation](API\Runtime\MovieScene\EntitySystem\FEntityAllocation) is the authoritative storage of entity-component data within an [FEntityManager](API\Runtime\MovieScene\EntitySystem\FEntityManager).

Windows
MacOS
Linux

References

Module

MovieScene

Header

/Engine/Source/Runtime/MovieScene/Public/EntitySystem/MovieSceneEntitySystemTypes.h

Include

#include "EntitySystem/MovieSceneEntitySystemTypes.h"

Syntax

struct FEntityAllocation

Remarks

FEntityAllocation is the authoritative storage of entity-component data within an FEntityManager. It stores component data in separate contiguous arrays, aligned to a cache line. Storing component data in this way allows for cache-efficient and concurrent access to each component array in isolation. It also allows for write access to component arrays at the same time as concurrent read-access to other component arrays within the same entity allocation.

FEntityAllocations are custom allocated according to the size of its component capacity, which is loosely computed as sizeof(FEntityAllocation) + sizeof(ComponentData), not simply sizeof(FEntityAllocation).

A typical allocation will look like this in memory:

uint32 {UniqueID}, uint16 {NumComponents}, uint16 {Size}, uint16 {Capacity}, uint16 {MaxCapacity}, uint32 {SerialNumber}, FMovieSceneEntityID* {EntityIDs}, < points to FMovieSceneEntityID array at end of structure FComponentHeader[NumComponents], < each component header contains a component array ptr that points to its corresponding type array below (padding) FMovieSceneEntityID[Capacity], (padding) ComponentType1[Capacity], (padding) ComponentType2[Capacity], (padding) ComponentType3[Capacity],

Variables

Name Description

Public variable

FComponentHeade...

 

ComponentHeaders

Pointer to array of the component headers of size NumComponents (stored in the end padding of this structure).

Constructors

Name Description

Public function

FEntityAllocation()

Constructor that initializes the defaults for this structure.

Public function

FEntityAllocation

(
    const FEntityAllocation&
)

Entity allocations are non-copyable

Destructors

Name Description

Public function

~FEntityAllocation()

Manually invoked destructor that calls the destructor of each component header according to the number of components

Functions

Name Description

Public function

FComponentHe...

 

FindComponentHeader

(
    FComponentTypeID ComponentTypeID
)

Find a component header by its type

Public function Const

const FCompo...

 

FindComponentHeader

(
    FComponentTypeID ComponentTypeID
)

Find a component header by its type

Public function Const

int32

 

GetCapacity()

Retrieve the number of entities this allocation can currently house without reallocation

Public function

FComponentHe...

 

GetComponentHeaderChecked

(
    FComponentTypeID ComponentTypeID
)

Get a reference to a component header by its type. Will fail an assertion if it does not exist.

Public function Const

const FCompo...

 

GetComponentHeaderChecked

(
    FComponentTypeID ComponentTypeID
)

Get a reference to a component header by its type. Will fail an assertion if it does not exist.

Public function Const

TArrayView< ...

 

GetComponentHeaders()

Retrieve all of this allocation's component and tag headers.

Public function

TArrayView< ...

 

GetComponentHeaders()

Retrieve all of this allocation's component and tag headers.

Public function Const

TArrayView< ...

 

GetEntityIDs()

Retrieve all of this allocation's entity IDs

Public function Const

int32

 

GetMaxCapacity()

Retrieve the maximum number of entities that this allocation is allowed to grow to until a new one must be made

Public function Const

int32

 

GetNumComponentTypes()

Get the number of component types and tags that exist within this allocation

Public function Const

const FMovie...

 

GetRawEntityIDs()

Retrieve all of this allocation's entity IDs as a raw ptr

Public function Const

int32

 

GetSlack()

Retrieve the amount of empty space within this allocation

Public function Const

uint32

 

GetUniqueID()

Get the unique identifier for this allocation.

Public function Const

bool

 

HasComponent

(
    FComponentTypeID ComponentTypeID
)

Check whether this allocation has the specified component type

Public function Const

bool

 

HasStructureChangedSince

(
    uint64 InSystemVersion
)

Retrieve this allocation's serial number.

Public function Const

int32

 

Num()

Retrieve the number of entities in this allocation

Public function

void

 

PostModifyStructure

(
    FEntityAllocationWriteContext InWri...
)

Public function

void

 

PostModifyStructureExcludingHeaders

(
    FEntityAllocationWriteContext InWri...
)

Called when this allocation has been modified.

Public function Const

TComponentLo...

 

ReadComponents

(
    TComponentTypeID< T > ComponentType
)

Read typed component data for the specified component type

Public function Const

TComponentLo...

 

ReadComponentsErased

(
    FComponentTypeID ComponentType
)

Read type-erased component data for the specified component type

Public function Const

TComponentLo...

 

TryReadComponents

(
    TComponentTypeID< T > ComponentType
)

Write typed component data for the specified component type

Public function Const

TComponentLo...

 

TryReadComponentsErased

(
    FComponentTypeID ComponentType
)

Attempt to read type-erased component data for the specified component type

Public function Const

TComponentLo...

 

TryWriteComponents

(
    TComponentTypeID< T > ComponentType,
    FEntityAllocationWriteContext InWri...
)

Attempt to write typed component data for the specified component type

Public function Const

TComponentLo...

 

TryWriteComponentsErased

(
    FComponentTypeID ComponentType,
    FEntityAllocationWriteContext InWri...
)

Attempt to write type-erased component data for the specified component type

Public function Const

TComponentLo...

 

WriteComponents

(
    TComponentTypeID< T > ComponentType,
    FEntityAllocationWriteContext InWri...
)

Write typed component data for the specified component type

Public function Const

TComponentLo...

 

WriteComponentsErased

(
    FComponentTypeID ComponentType,
    FEntityAllocationWriteContext InWri...
)

Write type-erased component data for the specified component type

Operators

Name Description

Public function

FEntityAlloc...

 

operator=

(
    const FEntityAllocation&
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss