UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::MovieScene::FEntityAllocation Struct Reference

#include <MovieSceneEntitySystemTypes.h>

Public Member Functions

 FEntityAllocation ()
 
 ~FEntityAllocation ()
 
 FEntityAllocation (const FEntityAllocation &)=delete
 
FEntityAllocationoperator= (const FEntityAllocation &)=delete
 
TArrayView< const FComponentHeaderGetComponentHeaders () const
 
TArrayView< FComponentHeaderGetComponentHeaders ()
 
bool HasComponent (FComponentTypeID ComponentTypeID) const
 
const FComponentHeaderFindComponentHeader (FComponentTypeID ComponentTypeID) const
 
FComponentHeaderFindComponentHeader (FComponentTypeID ComponentTypeID)
 
const FComponentHeaderGetComponentHeaderChecked (FComponentTypeID ComponentTypeID) const
 
FComponentHeaderGetComponentHeaderChecked (FComponentTypeID ComponentTypeID)
 
TArrayView< const FMovieSceneEntityIDGetEntityIDs () const
 
const FMovieSceneEntityIDGetRawEntityIDs () const
 
const voidGetComponentDataAddress () const
 
uint32 GetUniqueID () const
 
bool HasStructureChangedSince (uint64 InSystemVersion) const
 
void PostModifyStructureExcludingHeaders (FEntityAllocationWriteContext InWriteContext)
 
void PostModifyStructure (FEntityAllocationWriteContext InWriteContext)
 
int32 GetNumComponentTypes () const
 
int32 Num () const
 
int32 GetMaxCapacity () const
 
int32 GetCapacity () const
 
int32 GetSlack () const
 
EComponentHeaderLockMode GetCurrentLockMode () const
 
MOVIESCENE_API TComponentLock< FReadErasedReadComponentsErased (FComponentTypeID ComponentType) const
 
MOVIESCENE_API TComponentLock< FWriteErasedWriteComponentsErased (FComponentTypeID ComponentType, FEntityAllocationWriteContext InWriteContext) const
 
MOVIESCENE_API TComponentLock< FReadErasedOptionalTryReadComponentsErased (FComponentTypeID ComponentType) const
 
MOVIESCENE_API TComponentLock< FWriteErasedOptionalTryWriteComponentsErased (FComponentTypeID ComponentType, FEntityAllocationWriteContext InWriteContext) const
 
template<typename T >
TComponentLock< TRead< T > > ReadComponents (TComponentTypeID< T > ComponentType) const
 
template<typename T >
TComponentLock< TReadOptional< T > > TryReadComponents (TComponentTypeID< T > ComponentType) const
 
template<typename T >
TComponentLock< TWrite< T > > WriteComponents (TComponentTypeID< T > ComponentType, FEntityAllocationWriteContext InWriteContext) const
 
template<typename T >
TComponentLock< TWriteOptional< T > > TryWriteComponents (TComponentTypeID< T > ComponentType, FEntityAllocationWriteContext InWriteContext) const
 

Public Attributes

FComponentHeaderComponentHeaders
 

Friends

struct FEntityInitializer
 
struct FEntityAllocationMutexGuard
 

Detailed Description

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],

Constructor & Destructor Documentation

◆ FEntityAllocation() [1/2]

UE::MovieScene::FEntityAllocation::FEntityAllocation ( )
inline

Constructor that initializes the defaults for this structure. CAUTION: Does not initialize ComponentHeaders - these constructors must be called manually

◆ ~FEntityAllocation()

UE::MovieScene::FEntityAllocation::~FEntityAllocation ( )
inline

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

◆ FEntityAllocation() [2/2]

UE::MovieScene::FEntityAllocation::FEntityAllocation ( const FEntityAllocation )
delete

Entity allocations are non-copyable

Member Function Documentation

◆ FindComponentHeader() [1/2]

FComponentHeader * UE::MovieScene::FEntityAllocation::FindComponentHeader ( FComponentTypeID  ComponentTypeID)
inline

Find a component header by its type

Parameters
ComponentTypeIDThe type ID for the component header to locate
Returns
A pointer to the component header, or nullptr if one was not found

◆ FindComponentHeader() [2/2]

const FComponentHeader * UE::MovieScene::FEntityAllocation::FindComponentHeader ( FComponentTypeID  ComponentTypeID) const
inline

Find a component header by its type

Parameters
ComponentTypeIDThe type ID for the component header to locate
Returns
A pointer to the component header, or nullptr if one was not found

◆ GetCapacity()

int32 UE::MovieScene::FEntityAllocation::GetCapacity ( ) const
inline

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

◆ GetComponentDataAddress()

const void * UE::MovieScene::FEntityAllocation::GetComponentDataAddress ( ) const
inline

Retrieve the address of this allocation's component data. Only to be used for construction of TRelativePtrs.

◆ GetComponentHeaderChecked() [1/2]

FComponentHeader & UE::MovieScene::FEntityAllocation::GetComponentHeaderChecked ( FComponentTypeID  ComponentTypeID)
inline

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

Parameters
ComponentTypeIDThe type ID for the component header to locate
Returns
A reference to the component header

◆ GetComponentHeaderChecked() [2/2]

const FComponentHeader & UE::MovieScene::FEntityAllocation::GetComponentHeaderChecked ( FComponentTypeID  ComponentTypeID) const
inline

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

Parameters
ComponentTypeIDThe type ID for the component header to locate
Returns
A reference to the component header

◆ GetComponentHeaders() [1/2]

TArrayView< FComponentHeader > UE::MovieScene::FEntityAllocation::GetComponentHeaders ( )
inline

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

◆ GetComponentHeaders() [2/2]

TArrayView< const FComponentHeader > UE::MovieScene::FEntityAllocation::GetComponentHeaders ( ) const
inline

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

◆ GetCurrentLockMode()

EComponentHeaderLockMode UE::MovieScene::FEntityAllocation::GetCurrentLockMode ( ) const
inline

Get this allocation's current lock mode

◆ GetEntityIDs()

TArrayView< const FMovieSceneEntityID > UE::MovieScene::FEntityAllocation::GetEntityIDs ( ) const
inline

Retrieve all of this allocation's entity IDs

◆ GetMaxCapacity()

int32 UE::MovieScene::FEntityAllocation::GetMaxCapacity ( ) const
inline

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

◆ GetNumComponentTypes()

int32 UE::MovieScene::FEntityAllocation::GetNumComponentTypes ( ) const
inline

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

◆ GetRawEntityIDs()

const FMovieSceneEntityID * UE::MovieScene::FEntityAllocation::GetRawEntityIDs ( ) const
inline

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

◆ GetSlack()

int32 UE::MovieScene::FEntityAllocation::GetSlack ( ) const
inline

Retrieve the amount of empty space within this allocation

◆ GetUniqueID()

uint32 UE::MovieScene::FEntityAllocation::GetUniqueID ( ) const
inline

Get the unique identifier for this allocation. This identifier is unique to the specific allocation and entity manager, but is not globally unique. Typically used for caching component data on a per-allocation basis

◆ HasComponent()

bool UE::MovieScene::FEntityAllocation::HasComponent ( FComponentTypeID  ComponentTypeID) const
inline

Check whether this allocation has the specified component type

Parameters
ComponentTypeIDThe type ID for the component to check
Returns
true if these entities have the specified component, false otherwise

◆ HasStructureChangedSince()

bool UE::MovieScene::FEntityAllocation::HasStructureChangedSince ( uint64  InSystemVersion) const
inline

Retrieve this allocation's serial number. The serial number is incremented whenever a component is modified on this allocation, or when an entity is added or removed. Typically used for caching component data on a per-allocation basis

◆ Num()

int32 UE::MovieScene::FEntityAllocation::Num ( ) const
inline

Retrieve the number of entities in this allocation

◆ operator=()

FEntityAllocation & UE::MovieScene::FEntityAllocation::operator= ( const FEntityAllocation )
delete

◆ PostModifyStructure()

void UE::MovieScene::FEntityAllocation::PostModifyStructure ( FEntityAllocationWriteContext  InWriteContext)
inline

◆ PostModifyStructureExcludingHeaders()

void UE::MovieScene::FEntityAllocation::PostModifyStructureExcludingHeaders ( FEntityAllocationWriteContext  InWriteContext)
inline

Called when this allocation has been modified. Will invalidate any cached data based of this allocation's serial number

◆ ReadComponents()

template<typename T >
TComponentLock< TRead< T > > UE::MovieScene::FEntityAllocation::ReadComponents ( TComponentTypeID< T >  ComponentType) const
inline

Read typed component data for the specified component type

◆ ReadComponentsErased()

FComponentReader UE::MovieScene::FEntityAllocation::ReadComponentsErased ( FComponentTypeID  ComponentType) const

Read type-erased component data for the specified component type

◆ TryReadComponents()

template<typename T >
TComponentLock< TReadOptional< T > > UE::MovieScene::FEntityAllocation::TryReadComponents ( TComponentTypeID< T >  ComponentType) const
inline

Write typed component data for the specified component type

◆ TryReadComponentsErased()

FOptionalComponentReader UE::MovieScene::FEntityAllocation::TryReadComponentsErased ( FComponentTypeID  ComponentType) const

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

◆ TryWriteComponents()

template<typename T >
TComponentLock< TWriteOptional< T > > UE::MovieScene::FEntityAllocation::TryWriteComponents ( TComponentTypeID< T >  ComponentType,
FEntityAllocationWriteContext  InWriteContext 
) const
inline

Attempt to write typed component data for the specified component type

◆ TryWriteComponentsErased()

FOptionalComponentWriter UE::MovieScene::FEntityAllocation::TryWriteComponentsErased ( FComponentTypeID  ComponentType,
FEntityAllocationWriteContext  InWriteContext 
) const

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

◆ WriteComponents()

template<typename T >
TComponentLock< TWrite< T > > UE::MovieScene::FEntityAllocation::WriteComponents ( TComponentTypeID< T >  ComponentType,
FEntityAllocationWriteContext  InWriteContext 
) const
inline

Write typed component data for the specified component type

◆ WriteComponentsErased()

FComponentWriter UE::MovieScene::FEntityAllocation::WriteComponentsErased ( FComponentTypeID  ComponentType,
FEntityAllocationWriteContext  InWriteContext 
) const

Write type-erased component data for the specified component type

Friends And Related Symbol Documentation

◆ FEntityAllocationMutexGuard

◆ FEntityInitializer

Member Data Documentation

◆ ComponentHeaders

FComponentHeader* UE::MovieScene::FEntityAllocation::ComponentHeaders

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


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