UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FStructTracker Struct Reference

#include <StructTypeBitSet.h>

+ Inheritance diagram for FStructTracker:

Public Types

using FBaseStructGetter = TFunction< UStruct *()>
 
using FTypeValidation = TFunction< bool(const UStruct *)>
 

Public Member Functions

UE_API FStructTracker (const FBaseStructGetter &InBaseStructGetter)
 
UE_API FStructTracker (const UStruct *InBaseType, const FTypeValidation &InTypeVerification=FTypeValidation())
 
UE_API ~FStructTracker ()
 
 UE_NONCOPYABLE (FStructTracker)
 
UE_API int32 FindStructTypeIndex (const UStruct &InStructType) const
 
UE_API int32 FindOrAddStructTypeIndex (const UStruct &InStructType)
 
int32 Register (const UStruct &InStructType)
 
const UStructGetStructType (const int32 StructTypeIndex) const
 
UE_API const UStructGetBaseType () const
 
int32 Num () const
 
UE_API void Serialize (FArchive &Ar, FStructTypeBitSet::FBitSetContainer &StructTypesBitArray)
 

Protected Member Functions

UE_API int32 RegisterImplementation (const UStruct &InStructType, const bool bCheckPrevious)
 

Protected Attributes

TSet< uint32StructTypeToIndexSet
 
TArray< TWeakObjectPtr< const UStruct >, TInlineAllocator< 64 > > StructTypesList
 
uint32 SerializationHash = 0
 
uint32 bIsSerializable: 1 = true
 
const FBaseStructGetter BaseStructGetter
 
const FTypeValidation TypeVerification
 

Detailed Description

FStructTracker is a utility class used to track and map UStruct types to indices, which are used in bitsets. It manages a mapping between UStruct instances and integer indices, allowing for efficient storage and querying of types in a bitset

The FStructTracker assigns an index to a given type the first time it encounters it

Member Typedef Documentation

◆ FBaseStructGetter

◆ FTypeValidation

Constructor & Destructor Documentation

◆ FStructTracker() [1/2]

FStructTracker::FStructTracker ( const FBaseStructGetter InBaseStructGetter)
explicit

The input parameter is a function that fetches the UStruct representing the base class for all the stored structs. We're unable to get the UStruct parameter directly since FStructTracker instances are being created during module loading (via DEFINE_TYPEBITSET macro), and the StaticStruct call fails at that point for types defined in the same module.

◆ FStructTracker() [2/2]

FStructTracker::FStructTracker ( const UStruct InBaseType,
const FTypeValidation InTypeVerification = FTypeValidation() 
)
explicit

◆ ~FStructTracker()

FStructTracker::~FStructTracker ( )

Member Function Documentation

◆ FindOrAddStructTypeIndex()

int32 FStructTracker::FindOrAddStructTypeIndex ( const UStruct InStructType)

Fetches the internal index representing the given UStruct instance. If it hasn't been registered yet, it will be automatically added.

Returns
the index for the given type.

◆ FindStructTypeIndex()

int32 FStructTracker::FindStructTypeIndex ( const UStruct InStructType) const
Returns
the index for the given type, or INDEX_NONE if it hasn't been registered with this struct tracker

◆ GetBaseType()

FORCEINLINE const UStruct * FStructTracker::GetBaseType ( ) const

Retrieves the base UStruct type used for validation.

Returns
Pointer to the base UStruct.

◆ GetStructType()

const UStruct * FStructTracker::GetStructType ( const int32  StructTypeIndex) const
inline

Retrieves the UStruct type associated with a given index

Parameters
StructTypeIndex- The index of the struct type
Returns
Pointer to the UStruct if found, nullptr otherwise

◆ Num()

int32 FStructTracker::Num ( ) const
inline

Gets the number of registered struct types.

Returns
Number of struct types.

◆ Register()

int32 FStructTracker::Register ( const UStruct InStructType)
inline

Registers the given UStruct with the struct tracker.

Returns
the index for the registered type.

◆ RegisterImplementation()

int32 FStructTracker::RegisterImplementation ( const UStruct InStructType,
const bool  bCheckPrevious 
)
protected

◆ Serialize()

void FStructTracker::Serialize ( FArchive Ar,
FStructTypeBitSet::FBitSetContainer StructTypesBitArray 
)

Serializes the struct types bit array using the archive provided.

Parameters
Ar- The archive to serialize with.
StructTypesBitArray- The bit array representing struct types.

◆ UE_NONCOPYABLE()

FStructTracker::UE_NONCOPYABLE ( FStructTracker  )

Member Data Documentation

◆ BaseStructGetter

const FBaseStructGetter FStructTracker::BaseStructGetter
protected

Function to retrieve the base UStruct

◆ bIsSerializable

uint32 FStructTracker::bIsSerializable
protected

Flag indicating whether this tracker is serializable

◆ SerializationHash

uint32 FStructTracker::SerializationHash = 0
protected

Hash used during serialization to detect mismatches

◆ StructTypesList

TArray<TWeakObjectPtr<const UStruct>, TInlineAllocator<64> > FStructTracker::StructTypesList
protected

List of weak pointers to struct types, indexed by their assigned indices

◆ StructTypeToIndexSet

TSet<uint32> FStructTracker::StructTypeToIndexSet
protected

Set mapping struct type hashes to their indices

◆ TypeVerification

const FTypeValidation FStructTracker::TypeVerification
protected

Function to perform additional type verification


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