Apparatus Version 1.8
ECS data-oriented workflow for Unreal Engine.
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
FTraitmark Struct Reference

The trait-only fingerprint part. More...

#include <Traitmark.h>

Collaboration diagram for FTraitmark:
Collaboration graph
[legend]

Public Types

enum  { InvalidTraitId = -1 , InlineTraitsCount = 8 }
 
typedef TArray< UScriptStruct *, TInlineAllocator< InlineTraitsCount > > TraitsType
 The type for traits array. More...
 

Public Member Functions

EBootFilter GetBootState () const
 Get the active boot state. More...
 
EApparatusStatus SetBootState (const EBootFilter InBootState)
 Set the new active boot state. More...
 
EApparatusStatus SetBooted (bool bState=true)
 Set the new active boot state. More...
 
bool IsBooted () const
 Check if the traitmark corresponds to a booted entity. More...
 
const TraitsTypeGetTraits () const
 Get the traits of the traitmark. More...
 
int32 TraitsNum () const
 The number of traits in the traitmark. More...
 
const FBitMaskGetTraitsMask () const
 Get the traits mask of the traitmark. More...
 
UScriptStruct * TraitAt (const int32 Index) const
 Get a trait type by its index. More...
 
UScriptStruct * operator[] (int32 Index) const
 Get a trait type by its index. More...
 
 operator bool () const
 Check if a traitmark is viable and has any actual effect. More...
 
int32 IndexOf (const UScriptStruct *TraitType) const
 Get the index of a specific trait type. More...
 
template<typename TAllocatorA , typename TAllocatorB >
EApparatusStatus FindMappingFrom (const TArray< UScriptStruct *, TAllocatorA > &InTraitmark, TArray< int32, TAllocatorB > &OutMapping) const
 Get an indexing mapping from another traitmark defined by an array of traits. More...
 
template<typename TAllocator >
EApparatusStatus FindMappingFrom (const FTraitmark &InTraitmark, TArray< int32, TAllocator > &OutMapping) const
 Get an indexing mapping from another traitmark's traits. More...
 
template<typename TAllocator >
EApparatusStatus FindMappingTo (const TArray< UScriptStruct * > &InTraitmark, TArray< int32, TAllocator > &OutMapping) const
 Get an indexing mapping to an another traitmark defined by an array of traits. More...
 
template<typename TAllocator >
EApparatusStatus FindMappingTo (const FTraitmark &InTraitmark, TArray< int32, TAllocator > &OutMapping) const
 Get an indexing traits mapping to another traitmark. More...
 
bool Contains (const UScriptStruct *const TraitType) const
 Check if the traitmark includes a trait type. More...
 
template<typename T >
bool Contains () const
 Check if the traitmark includes a trait type. More...
 
bool Matches (const FFilter &Filter) const
 Check if the traitmark matches a filter. More...
 
bool Matches (const FTraitmark &Traitmark) const
 Check if the traitmark matches another traitmark acting as a filter. More...
 
EApparatusStatus Set (const TArray< UScriptStruct * > &InTraits, const EBootFilter InBootState=EBootFilter::None)
 Set a traitmark to an array of traits and a boot state. More...
 
EApparatusStatus Set (FTraitmark &&InTraitmark)
 Move a traitmark to this traitmark. More...
 
EApparatusStatus Set (const FTraitmark &InTraitmark)
 Set a traitmark equal to another traitmark. More...
 
FTraitmarkoperator= (FTraitmark &&InTraitmark)
 Move a traitmark. More...
 
FTraitmarkoperator= (const FTraitmark &InTraitmark)
 Set a traitmark equal to another traitmark. More...
 
EApparatusStatus Add (std::initializer_list< UScriptStruct * > TraitTypes)
 Add trait types to a fingerprint. More...
 
EApparatusStatus Add (const EBootFilter InBootState)
 Add a boot state specification. More...
 
EApparatusStatus Add (const FTraitmark &Traitmark, const EBootFilter InBootState=EBootFilter::None)
 Add a traitmark. More...
 
EApparatusStatus Add (UScriptStruct *TraitType)
 Add a trait type. More...
 
EApparatusStatus Add (const TArray< UScriptStruct * > &InTraits, const EBootFilter InBootState=EBootFilter::None)
 Add an array of traits and a boot state specification. More...
 
template<typename T >
EApparatusStatus Add (const EBootFilter InBootState=EBootFilter::None)
 Add a generic trait type. More...
 
FTraitmarkoperator+= (std::initializer_list< UScriptStruct * > TraitTypes)
 Add variadic trait types. More...
 
FTraitmarkoperator+= (const TArray< UScriptStruct * > &TraitTypes)
 Add an array of trait types. More...
 
FTraitmarkoperator+= (UScriptStruct *TraitType)
 Add a single trait type. More...
 
EApparatusStatus Remove (UScriptStruct *TraitType)
 Remove a trait type from the traitmark specification. More...
 
FTraitmarkoperator-= (UScriptStruct *const TraitType)
 Remove a trait type from the traitmark. More...
 
template<typename T >
EApparatusStatus Remove ()
 Remove a type from a traitmark. More...
 
EApparatusStatus Reset (const EBootFilter InBootState=EBootFilter::None)
 Clear the traitmark without any deallocations. More...
 
FString ToString () const
 Convert a traitmark to a string. More...
 
 FTraitmark (const EBootFilter InBootState=EBootFilter::None)
 Construct a new traitmark with an optional boot state. More...
 
 FTraitmark (FTraitmark &&Traitmark)
 Move-construct a new traitmark. More...
 
 FTraitmark (const FTraitmark &Traitmark)
 Construct a new traitmark as a copy of another one. More...
 
 FTraitmark (const FTraitmark &Traitmark, const EBootFilter InBootState)
 Construct a new traitmark as a copy of another one and a boot state override. More...
 
 FTraitmark (UScriptStruct *TraitType, const EBootFilter InBootState=EBootFilter::None)
 Initialize a new traitmark with a single detail type. More...
 
 FTraitmark (std::initializer_list< UScriptStruct * > InTraits, const EBootFilter InBootState=EBootFilter::None)
 Construct a new traitmark with an initializer list of traits and an optional boot state. More...
 
template<typename TAllocator >
 FTraitmark (const TArray< UScriptStruct *, TAllocator > &InTraits, const EBootFilter InBootState=EBootFilter::None)
 Construct a new traitmark with an array of traits and an optional boot state. More...
 

Static Public Member Functions

static int32 RegisteredTraitsNum ()
 Get the total number of registered trait types. More...
 
static int32 GetTraitId (const UScriptStruct *TraitType)
 Get a trait's unique identifier. More...
 
static const FBitMaskGetTraitMask (const UScriptStruct *TraitType)
 Get the cached mask for a trait type. More...
 
template<class T >
static const FBitMaskGetTraitMask ()
 Get the mask of a trait. More...
 

Static Public Attributes

static const FTraitmark Zero
 An empty traitmark constant. More...
 
static const FTraitmark Halted
 The default traitmark for newly spanwed subjects. More...
 

Friends

struct FFingerprint
 
struct FFilter
 
class UChunk
 
struct FSubjectHandle
 
class UBelt
 
class AMechanism
 
class UApparatusFunctionLibrary
 

Detailed Description

The trait-only fingerprint part.

Member Typedef Documentation

◆ TraitsType

typedef TArray<UScriptStruct*, TInlineAllocator<InlineTraitsCount> > FTraitmark::TraitsType

The type for traits array.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidTraitId 

Invalid trait identifier.

InlineTraitsCount 

The number of inline-allocated traits in the Traitmark.

Constructor & Destructor Documentation

◆ FTraitmark() [1/7]

FTraitmark::FTraitmark ( const EBootFilter  InBootState = EBootFilter::None)
inline

Construct a new traitmark with an optional boot state.

◆ FTraitmark() [2/7]

FTraitmark::FTraitmark ( FTraitmark &&  Traitmark)
inline

Move-construct a new traitmark.

◆ FTraitmark() [3/7]

FTraitmark::FTraitmark ( const FTraitmark Traitmark)
inline

Construct a new traitmark as a copy of another one.

◆ FTraitmark() [4/7]

FTraitmark::FTraitmark ( const FTraitmark Traitmark,
const EBootFilter  InBootState 
)
inline

Construct a new traitmark as a copy of another one and a boot state override.

◆ FTraitmark() [5/7]

FTraitmark::FTraitmark ( UScriptStruct *  TraitType,
const EBootFilter  InBootState = EBootFilter::None 
)
inline

Initialize a new traitmark with a single detail type.

Parameters
TraitTypeA detail type to initialize with.
InBootStateA boot state filter to specify.

◆ FTraitmark() [6/7]

FTraitmark::FTraitmark ( std::initializer_list< UScriptStruct * >  InTraits,
const EBootFilter  InBootState = EBootFilter::None 
)
inline

Construct a new traitmark with an initializer list of traits and an optional boot state.

◆ FTraitmark() [7/7]

template<typename TAllocator >
FTraitmark::FTraitmark ( const TArray< UScriptStruct *, TAllocator > &  InTraits,
const EBootFilter  InBootState = EBootFilter::None 
)
inline

Construct a new traitmark with an array of traits and an optional boot state.

Member Function Documentation

◆ Add() [1/6]

EApparatusStatus FTraitmark::Add ( const EBootFilter  InBootState)
inline

Add a boot state specification.

Returns
The status of the operation.

◆ Add() [2/6]

template<typename T >
EApparatusStatus FTraitmark::Add ( const EBootFilter  InBootState = EBootFilter::None)
inline

Add a generic trait type.

Returns
The status of the operation.

◆ Add() [3/6]

EApparatusStatus FTraitmark::Add ( const FTraitmark Traitmark,
const EBootFilter  InBootState = EBootFilter::None 
)
inline

Add a traitmark.

Returns
The status of the operation.

◆ Add() [4/6]

EApparatusStatus FTraitmark::Add ( const TArray< UScriptStruct * > &  InTraits,
const EBootFilter  InBootState = EBootFilter::None 
)
inline

Add an array of traits and a boot state specification.

Returns
The status of the operation.

◆ Add() [5/6]

EApparatusStatus FTraitmark::Add ( std::initializer_list< UScriptStruct * >  TraitTypes)
inline

Add trait types to a fingerprint.

Returns
The status of the operation.

◆ Add() [6/6]

EApparatusStatus FTraitmark::Add ( UScriptStruct *  TraitType)
inline

Add a trait type.

Parameters
TraitTypeA type of the detail to add.
Returns
The status of the operation.

◆ Contains() [1/2]

template<typename T >
bool FTraitmark::Contains ( ) const
inline

Check if the traitmark includes a trait type.

◆ Contains() [2/2]

bool FTraitmark::Contains ( const UScriptStruct *const  TraitType) const
inline

Check if the traitmark includes a trait type.

◆ FindMappingFrom() [1/2]

template<typename TAllocator >
EApparatusStatus FTraitmark::FindMappingFrom ( const FTraitmark InTraitmark,
TArray< int32, TAllocator > &  OutMapping 
) const
inline

Get an indexing mapping from another traitmark's traits.

Parameters
InTraitmarkA traitmark to get a mapping from.
OutMappingThe resulting traits mapping.

◆ FindMappingFrom() [2/2]

template<typename TAllocatorA , typename TAllocatorB >
EApparatusStatus FTraitmark::FindMappingFrom ( const TArray< UScriptStruct *, TAllocatorA > &  InTraitmark,
TArray< int32, TAllocatorB > &  OutMapping 
) const
inline

Get an indexing mapping from another traitmark defined by an array of traits.

Parameters
InTraitmarkA traitmark to get a mapping from as an array of trait types.
OutMappingThe resulting mapping.

◆ FindMappingTo() [1/2]

template<typename TAllocator >
EApparatusStatus FTraitmark::FindMappingTo ( const FTraitmark InTraitmark,
TArray< int32, TAllocator > &  OutMapping 
) const
inline

Get an indexing traits mapping to another traitmark.

Parameters
InTraitmarkA traitmark to get the traits mapping to.
OutMappingThe resulting mapping.

◆ FindMappingTo() [2/2]

template<typename TAllocator >
EApparatusStatus FTraitmark::FindMappingTo ( const TArray< UScriptStruct * > &  InTraitmark,
TArray< int32, TAllocator > &  OutMapping 
) const
inline

Get an indexing mapping to an another traitmark defined by an array of traits.

Parameters
InTraitmarkA traitmark to get a mapping to.
OutMappingThe resulting mapping.

◆ GetBootState()

EBootFilter FTraitmark::GetBootState ( ) const
inline

Get the active boot state.

◆ GetTraitId()

int32 FTraitmark::GetTraitId ( const UScriptStruct *  TraitType)
inlinestatic

Get a trait's unique identifier.

◆ GetTraitMask() [1/2]

template<class T >
static const FBitMask& FTraitmark::GetTraitMask ( )
inlinestatic

Get the mask of a trait.

◆ GetTraitMask() [2/2]

const FBitMask & FTraitmark::GetTraitMask ( const UScriptStruct *  TraitType)
inlinestatic

Get the cached mask for a trait type.

◆ GetTraits()

const TraitsType& FTraitmark::GetTraits ( ) const
inline

Get the traits of the traitmark.

◆ GetTraitsMask()

const FBitMask& FTraitmark::GetTraitsMask ( ) const
inline

Get the traits mask of the traitmark.

Constant version.

◆ IndexOf()

int32 FTraitmark::IndexOf ( const UScriptStruct *  TraitType) const
inline

Get the index of a specific trait type.

◆ IsBooted()

bool FTraitmark::IsBooted ( ) const
inline

Check if the traitmark corresponds to a booted entity.

◆ Matches() [1/2]

bool FTraitmark::Matches ( const FFilter Filter) const
inline

Check if the traitmark matches a filter.

◆ Matches() [2/2]

bool FTraitmark::Matches ( const FTraitmark Traitmark) const
inline

Check if the traitmark matches another traitmark acting as a filter.

◆ operator bool()

FTraitmark::operator bool ( ) const
inline

Check if a traitmark is viable and has any actual effect.

◆ operator+=() [1/3]

FTraitmark& FTraitmark::operator+= ( const TArray< UScriptStruct * > &  TraitTypes)
inline

Add an array of trait types.

◆ operator+=() [2/3]

FTraitmark& FTraitmark::operator+= ( std::initializer_list< UScriptStruct * >  TraitTypes)
inline

Add variadic trait types.

◆ operator+=() [3/3]

FTraitmark& FTraitmark::operator+= ( UScriptStruct *  TraitType)
inline

Add a single trait type.

◆ operator-=()

FTraitmark& FTraitmark::operator-= ( UScriptStruct *const  TraitType)
inline

Remove a trait type from the traitmark.

◆ operator=() [1/2]

FTraitmark& FTraitmark::operator= ( const FTraitmark InTraitmark)
inline

Set a traitmark equal to another traitmark.

◆ operator=() [2/2]

FTraitmark& FTraitmark::operator= ( FTraitmark &&  InTraitmark)
inline

Move a traitmark.

◆ operator[]()

UScriptStruct* FTraitmark::operator[] ( int32  Index) const
inline

Get a trait type by its index.

◆ RegisteredTraitsNum()

int32 FTraitmark::RegisteredTraitsNum ( )
inlinestatic

Get the total number of registered trait types.

◆ Remove() [1/2]

template<typename T >
EApparatusStatus FTraitmark::Remove ( )
inline

Remove a type from a traitmark.

Returns
The status of the operation.

◆ Remove() [2/2]

EApparatusStatus FTraitmark::Remove ( UScriptStruct *  TraitType)
inline

Remove a trait type from the traitmark specification.

Parameters
TraitTypeA trait type to remove.
Returns
The status of the operation.

◆ Reset()

EApparatusStatus FTraitmark::Reset ( const EBootFilter  InBootState = EBootFilter::None)
inline

Clear the traitmark without any deallocations.

◆ Set() [1/3]

EApparatusStatus FTraitmark::Set ( const FTraitmark InTraitmark)
inline

Set a traitmark equal to another traitmark.

◆ Set() [2/3]

EApparatusStatus FTraitmark::Set ( const TArray< UScriptStruct * > &  InTraits,
const EBootFilter  InBootState = EBootFilter::None 
)

Set a traitmark to an array of traits and a boot state.

◆ Set() [3/3]

EApparatusStatus FTraitmark::Set ( FTraitmark &&  InTraitmark)
inline

Move a traitmark to this traitmark.

◆ SetBooted()

EApparatusStatus FTraitmark::SetBooted ( bool  bState = true)
inline

Set the new active boot state.

Returns
The status of the operation.

◆ SetBootState()

EApparatusStatus FTraitmark::SetBootState ( const EBootFilter  InBootState)
inline

Set the new active boot state.

Returns
The status of the operation.

◆ ToString()

FString FTraitmark::ToString ( ) const

Convert a traitmark to a string.

◆ TraitAt()

UScriptStruct* FTraitmark::TraitAt ( const int32  Index) const
inline

Get a trait type by its index.

◆ TraitsNum()

int32 FTraitmark::TraitsNum ( ) const
inline

The number of traits in the traitmark.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ FFilter

friend struct FFilter
friend

◆ FFingerprint

friend struct FFingerprint
friend

◆ FSubjectHandle

friend struct FSubjectHandle
friend

◆ UApparatusFunctionLibrary

friend class UApparatusFunctionLibrary
friend

◆ UBelt

friend class UBelt
friend

◆ UChunk

friend class UChunk
friend

Member Data Documentation

◆ Halted

const FTraitmark FTraitmark::Halted
static

The default traitmark for newly spanwed subjects.

◆ Zero

const FTraitmark FTraitmark::Zero
static

An empty traitmark constant.


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