UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType > Struct Template Reference

#include <StructTypeBitSet.h>

+ Inheritance diagram for TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >:

Public Types

using Super = TTypeBitSetBase< TStructTypeBitSet, TBaseStruct, TUStructType, FStructTypeBitSet::FBitSetContainer >
 
using FStructTrackerWrapper = TStructTrackerWrapper
 
using FUStructType = TUStructType
 
using FBaseStruct = TBaseStruct
 
- Public Types inherited from TTypeBitSetBase< TImplementation, TBaseStruct, TStructType, TBitSetContainer, bTestInheritanceAtRuntime >
using FUStructType = TStructType
 
using FBaseStruct = TBaseStruct
 
using FContainer = TBitSetContainer
 

Public Member Functions

 TStructTypeBitSet ()=default
 
 TStructTypeBitSet (const FUStructType &StructType)
 
 TStructTypeBitSet (std::initializer_list< const FUStructType * > InitList)
 
 TStructTypeBitSet (TConstArrayView< const FUStructType * > InitList)
 
template<typename T = TBaseStruct, typename = typename TEnableIf<!TIsDerivedFrom<T, UObject>::IsDerived>::Type>
 TStructTypeBitSet (TConstArrayView< FInstancedStruct > InitList)
 
FStructTrackerGetStructTracker ()
 
const FStructTrackerGetStructTracker () const
 
template<typename T >
void Add ()
 
template<typename T >
void Remove ()
 
UE_FORCEINLINE_HINT void Remove (const TStructTypeBitSet &Other)
 
template<typename T >
bool Contains () const
 
TStructTypeBitSet operator+ (const TStructTypeBitSet &Other) const
 
UE_FORCEINLINE_HINT bool operator== (const TStructTypeBitSet &Other) const
 
UE_FORCEINLINE_HINT bool operator!= (const TStructTypeBitSet &Other) const
 
TStructTypeBitSet operator- (const TStructTypeBitSet &Other) const
 
void ExportTypes (TFunctionRef< bool(const FUStructType *)> Callback) const
 
FString DebugGetStringDesc () const
 
void Serialize (FArchive &Ar)
 
void Add (const FUStructType &InStructType)
 
void Remove (const FUStructType &InStructType)
 
bool Contains (const FUStructType &InStructType) const
 
UE_FORCEINLINE_HINT void operator+= (const TImplementation &Other)
 
UE_FORCEINLINE_HINT void operator-= (const TImplementation &Other)
 
TImplementation operator+ (const FUStructType &NewElement) const
 
TImplementation operator- (const FUStructType &NewElement) const
 
template<typename TOutStructType , typename Allocator >
void ExportTypes (TArray< const TOutStructType *, Allocator > &OutTypes) const
 
- Public Member Functions inherited from TTypeBitSetBase< TImplementation, TBaseStruct, TStructType, TBitSetContainer, bTestInheritanceAtRuntime >
FIndexIterator GetIndexIterator (const bool bValueToCheck=true) const
 
TImplementationGetImplementation ()
 
const TImplementationGetImplementation () const
 
void SetAll (const bool bValue=true)
 
void Add (const FUStructType &InStructType)
 
void AddAtIndex (const int32 StructTypeIndex)
 
void Remove (const FUStructType &InStructType)
 
void RemoveAtIndex (const int32 StructTypeIndex)
 
void Reset ()
 
bool Contains (const FUStructType &InStructType) const
 
UE_FORCEINLINE_HINT TImplementation operator& (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT TImplementation operator| (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT TImplementation GetOverlap (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT bool IsEquivalent (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT bool HasAll (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT bool HasAny (const TImplementation &Other) const
 
UE_FORCEINLINE_HINT bool HasNone (const TImplementation &Other) const
 
bool IsEmpty () const
 
UE_FORCEINLINE_HINT bool IsBitSet (const int32 BitIndex) const
 
UE_FORCEINLINE_HINT void operator+= (const TImplementation &Other)
 
UE_FORCEINLINE_HINT void operator-= (const TImplementation &Other)
 
TImplementation operator+ (const FUStructType &NewElement) const
 
TImplementation operator- (const FUStructType &NewElement) const
 
int32 CountStoredTypes () const
 
template<typename TOutStructType , typename Allocator >
void ExportTypes (TArray< const TOutStructType *, Allocator > &OutTypes) const
 
SIZE_T GetAllocatedSize () const
 

Static Public Member Functions

static int32 GetTypeIndex (const FUStructType &InStructType)
 
template<typename T >
static int32 GetTypeIndex ()
 
template<typename T >
static const TStructTypeBitSetGetTypeBitSet ()
 
static const FUStructTypeGetTypeAtIndex (const int32 Index)
 
static int32 GetMaxNum ()
 
static const UStructGetBaseUStruct ()
 
- Static Public Member Functions inherited from TTypeBitSetBase< TImplementation, TBaseStruct, TStructType, TBitSetContainer, bTestInheritanceAtRuntime >
static const UStructGetBaseUStruct ()
 

Public Attributes

friend Super
 
FContainer StructTypesBitArray
 

Friends

uint32 GetTypeHash (const TStructTypeBitSet &Instance)
 
FArchiveoperator<< (FArchive &Ar, TStructTypeBitSet &Instance)
 

Additional Inherited Members

- Protected Member Functions inherited from TTypeBitSetBase< TImplementation, TBaseStruct, TStructType, TBitSetContainer, bTestInheritanceAtRuntime >
 TTypeBitSetBase ()=default
 
 TTypeBitSetBase (FContainer &InContainer)
 
- Protected Attributes inherited from TTypeBitSetBase< TImplementation, TBaseStruct, TStructType, TBitSetContainer, bTestInheritanceAtRuntime >
FContainer StructTypesBitArray
 

Detailed Description

template<typename TBaseStruct, typename TStructTrackerWrapper, typename TUStructType = UScriptStruct>
struct TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >

The TStructTypeBitSet holds information on "existence" of subtypes of a given UStruct. The information on available child-structs is gathered lazily - the internal FStructTracker assigns a given type a new index the very first time the type is encountered. To create a specific instantiation of the type, you also need to provide a type that will instantiate a static FStructTracker instance. The supplied macros hide this detail.

To declare a bitset type for an arbitrary struct type FFooBar, add the following in your header or cpp file:

DECLARE_STRUCTTYPEBITSET(FMyFooBarBitSet, FFooBar);

where FMyFooBarBitSet is the alias of the type you can use in your code. To have your type exposed to other modules use DECLARE_STRUCTTYPEBITSET_EXPORTED, like so:

DECLARE_STRUCTTYPEBITSET_EXPORTED(MYMODULE_API, FMyFooBarBitSet, FFooBar);

You also need to instantiate the static FStructTracker added by the DECLARE* macro. You can easily do it by placing the following in your cpp file (continuing the FFooBar example):

DEFINE_TYPEBITSET(FMyFooBarBitSet);

Parameters
TBaseStruct- The base struct type for type validation.
TStructTrackerWrapper- A wrapper providing a FStructTracker instance.
TUStructType- Unreal's struct type, typically UScriptStruct or UClass (defaults to UScriptStruct).

Member Typedef Documentation

◆ FBaseStruct

◆ FStructTrackerWrapper

◆ FUStructType

◆ Super

Constructor & Destructor Documentation

◆ TStructTypeBitSet() [1/5]

◆ TStructTypeBitSet() [2/5]

Constructor that initializes the bitset with a single struct type.

Parameters
StructType- The struct type to add.

◆ TStructTypeBitSet() [3/5]

TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >::TStructTypeBitSet ( std::initializer_list< const FUStructType * >  InitList)
inlineexplicit

Constructor that initializes the bitset with an initializer list of struct types.

Parameters
InitList- The initializer list of struct type pointers.

◆ TStructTypeBitSet() [4/5]

Constructor that initializes the bitset with an array view of struct types.

Parameters
InitList- The array view of struct type pointers.

◆ TStructTypeBitSet() [5/5]

template<typename T = TBaseStruct, typename = typename TEnableIf<!TIsDerivedFrom<T, UObject>::IsDerived>::Type>
TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >::TStructTypeBitSet ( TConstArrayView< FInstancedStruct InitList)
inlineexplicit

This constructor is only available for UScriptStructs. Initializes the bitset with an array view of FInstancedStruct.

Parameters
InitList- The array view of FInstancedStruct.

Member Function Documentation

◆ Add() [1/2]

Adds a struct type to the bitset.

Parameters
T- The struct type to add.

◆ Add() [2/2]

Adds a struct type to the bitset.

Parameters
InStructType- The struct type to add.

◆ Contains() [1/2]

Checks if the bitset contains a specific struct type.

Parameters
T- The struct type to check for.
Returns
True if the struct type is in the bitset; false otherwise.

◆ Contains() [2/2]

Checks if the bitset contains a specific struct type.

Parameters
InStructType- The struct type to check for.
Returns
True if the struct type is in the bitset; false otherwise.

◆ DebugGetStringDesc()

FString TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >::DebugGetStringDesc ( ) const
inline

Provides a placeholder debug string when debug info is compiled out.

Returns
The placeholder string.

◆ ExportTypes() [1/2]

Exports types stored in the bitset to an output array. Note: This method can be slow due to the use of weak pointers in the struct tracker.

Parameters
OutTypes- The array to populate with struct types.

◆ ExportTypes() [2/2]

Lists all types used by this bitset, calling the provided callback for each one. Returning false from the callback will early-out of iterating over the types.

Note that this function is slow due to the FStructTracker utilizing WeakObjectPtrs to store types.

Parameters
Callback- The callback function to invoke for each type.

◆ GetBaseUStruct()

Retrieves the base UStruct type used for validation.

Returns
Pointer to the base UStruct.

◆ GetMaxNum()

Gets the maximum number of struct types registered in the tracker.

Returns
The number of struct types.

◆ GetStructTracker() [1/2]

Retrieves the FStructTracker associated with this bitset.

Returns
Reference to the FStructTracker.

◆ GetStructTracker() [2/2]

Retrieves the FStructTracker associated with this bitset (const version).

Returns
Const reference to the FStructTracker.

◆ GetTypeAtIndex()

static const FUStructType * TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >::GetTypeAtIndex ( const int32  Index)
inlinestatic

Gets the struct type associated with a given index.

Parameters
Index- The index of the struct type.
Returns
Pointer to the struct type if found; nullptr otherwise.

◆ GetTypeBitSet()

Gets a bitset representing a single struct type.

Parameters
T- The struct type to get the bitset for.
Returns
Reference to a static bitset representing the struct type.

◆ GetTypeIndex() [1/2]

Gets the index of a struct type within the tracker, adding it if not already present.

Parameters
T- The struct type to get the index for.
Returns
The index of the struct type.

◆ GetTypeIndex() [2/2]

static int32 TStructTypeBitSet< TBaseStruct, TStructTrackerWrapper, TUStructType >::GetTypeIndex ( const FUStructType InStructType)
inlinestatic

Gets the index of a struct type within the tracker, adding it if not already present.

Parameters
InStructType- The struct type to get the index for.
Returns
The index of the struct type.

◆ operator!=()

Inequality operator.

Parameters
Other- The other bitset to compare.
Returns
True if the bitsets are not equal; false otherwise.

◆ operator+() [1/2]

Adds a struct type to the bitset, returning a new bitset.

Parameters
NewElement- The struct type to add.
Returns
A new bitset with the added struct type.

◆ operator+() [2/2]

Performs a union operation with another bitset.

Parameters
Other- The other bitset to combine with.
Returns
A new bitset representing the union.

◆ operator+=()

Adds the bits from another bitset to this one (union).

Parameters
Other- The other bitset to add.

◆ operator-() [1/2]

Removes a struct type from the bitset, returning a new bitset.

Parameters
NewElement- The struct type to remove.
Returns
A new bitset with the struct type removed.

◆ operator-() [2/2]

Performs a difference operation with another bitset.

Parameters
Other- The other bitset to subtract.
Returns
A new bitset representing the difference.

◆ operator-=()

Removes the bits from another bitset from this one (difference).

Parameters
Other- The other bitset to subtract.

◆ operator==()

Equality operator.

Parameters
Other- The other bitset to compare
Returns
True if the bitsets are equal; false otherwise.

◆ Remove() [1/3]

Removes a struct type from the bitset.

Parameters
T- The struct type to remove.

◆ Remove() [2/3]

Removes a struct type from the bitset.

Parameters
InStructType- The struct type to remove.

◆ Remove() [3/3]

Removes the bits from another bitset from this one (difference).

Parameters
Other- The other bitset to subtract.

◆ Serialize()

Serializes the bitset using the provided archive.

Parameters
Ar- The archive to serialize with.

Friends And Related Symbol Documentation

◆ GetTypeHash

Hash function for the bitset.

Parameters
Instance- The bitset instance to hash.
Returns
The hash value.

◆ operator<<

Stream insertion operator for serialization.

Parameters
Ar- The archive to serialize with.
Instance- The bitset instance to serialize.
Returns
The archive after serialization.

Member Data Documentation

◆ StructTypesBitArray

The bitset container storing the bits representing struct types

◆ Super


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