![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#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 UStruct * | GetStructType (const int32 StructTypeIndex) const |
| UE_API const UStruct * | GetBaseType () 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< uint32 > | StructTypeToIndexSet |
| TArray< TWeakObjectPtr< const UStruct >, TInlineAllocator< 64 > > | StructTypesList |
| uint32 | SerializationHash = 0 |
| uint32 | bIsSerializable: 1 = true |
| const FBaseStructGetter | BaseStructGetter |
| const FTypeValidation | TypeVerification |
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
| using FStructTracker::FBaseStructGetter = TFunction<UStruct*()> |
| using FStructTracker::FTypeValidation = TFunction<bool(const UStruct*)> |
|
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.
|
explicit |
| FStructTracker::~FStructTracker | ( | ) |
Fetches the internal index representing the given UStruct instance. If it hasn't been registered yet, it will be automatically added.
| FORCEINLINE const UStruct * FStructTracker::GetBaseType | ( | ) | const |
|
inline |
Gets the number of registered struct types.
Registers the given UStruct with the struct tracker.
|
protected |
| void FStructTracker::Serialize | ( | FArchive & | Ar, |
| FStructTypeBitSet::FBitSetContainer & | StructTypesBitArray | ||
| ) |
Serializes the struct types bit array using the archive provided.
| Ar | - The archive to serialize with. |
| StructTypesBitArray | - The bit array representing struct types. |
| FStructTracker::UE_NONCOPYABLE | ( | FStructTracker | ) |
|
protected |
Function to retrieve the base UStruct
|
protected |
Flag indicating whether this tracker is serializable
|
protected |
Hash used during serialization to detect mismatches
|
protected |
List of weak pointers to struct types, indexed by their assigned indices
|
protected |
Set mapping struct type hashes to their indices
|
protected |
Function to perform additional type verification