Apparatus Version 1.23
ECS data-oriented workflow for Unreal Engine.
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
FSubjectRecord Struct Reference

A subject packed in a localized container scope. More...

#include <SubjectRecord.h>

Public Member Functions

const TArray< FTraitRecord > & GetTraits () const
 Get the trait records.
 
const FTraitRecord & TraitAt (const int32 Index) const
 Get a trait record at specified index.
 
int32 TraitsNum () const
 Get the number of traits in the subject.
 
const FFingerprintGetFingerprint () const
 Get the cached fingerprint of the subject record.
 
const FTraitmarkGetTraitmark () const
 Get the cached traitmark of the subject record.
 
EFlagmark GetFlagmark () const
 Get the flagmark of the subject.
 
EApparatusStatus SetFlagmark (const EFlagmark InFlagmark)
 Set the flagmark of the subject.
 
EApparatusStatus SetFlag (const EFlagmarkBit InFlag, bool bState=true)
 Set the flagmark bit for the subject.
 
bool HasFlag (const EFlagmarkBit InFlag) const
 Check if the flagmark bit is set on the subject.
 
void * GetTraitPtr (UScriptStruct *const TraitType)
 Get the trait's data pointer.
 
const void * GetTraitPtr (UScriptStruct *const TraitType) const
 Get the trait's data pointer.
 
template<typename T >
std::enable_if< IsTraitType< T >(), T * >::type GetTraitPtr ()
 Get the trait's data pointer.
 
template<typename T >
std::enable_if< IsTraitType< T >(), constT * >::type GetTraitPtr () const
 Get the trait's data pointer.
 
template<typename T >
std::enable_if< IsTraitType< T >(), T & >::type GetTraitRef ()
 Get the trait's data reference.
 
template<typename T >
std::enable_if< IsTraitType< T >(), constT & >::type GetTraitRef () const
 Get the trait's data reference.
 
template<typename T >
std::enable_if< IsTraitType< T >(), EApparatusStatus >::type SetTrait (const T &InTrait)
 Set a trait.
 
void * ObtainTraitPtr (UScriptStruct *const TraitType)
 Obtain a trait data pointer by its type.
 
template<typename T >
std::enable_if< IsTraitType< T >(), T & >::type ObtainTraitRef ()
 Obtain a trait data reference by its type.
 
bool Contains (UScriptStruct *const TraitType) const
 Check if the subject record contains a trait of specific type.
 
template<typename T >
std::enable_if< IsTraitType< T >(), bool >::type Contains () const
 Check if the subject record contains a trait of specific type.
 
Assignment
FSubjectRecordoperator= (FSubjectRecord &&InSubjectRecord)
 Move-assign the subject record from an another one.
 
FSubjectRecordoperator= (const FSubjectRecord &InSubjectRecord)
 Assign the subject record equal to an another record.
 
Initialization
 FSubjectRecord ()
 Construct a new empty subject pack.
 
 FSubjectRecord (const FSubjectRecord &InSubjectRecord)
 Initialize a subject record as a copy of another one.
 
 FSubjectRecord (FSubjectRecord &&InSubjectRecord)
 Move-construct a new packed subject.
 
 FSubjectRecord (const FTraitmark &InTraitmark, const EFlagmark InFlagmark=FM_None)
 Construct a new packed subject with a traitmark and a flagmark.
 
 FSubjectRecord (const FConstSubjectHandle &Subject, const EFlagmark FlagmarkMask=FM_AllUserLevel)
 Construct a new subject record as a copy of an existing subject.
 
 FSubjectRecord (const FConstSubjectHandle &Subject, const FFilter &Mask)
 Construct a new subject record as a copy of an existing subject masked with a filter.
 
Serialization
void PostSerialize (const FArchive &Archive)
 Post-serialize the record via an archive.
 
template<typename AllocatorT >
void SerializeBin (const TArray< UScriptStruct *, AllocatorT > &InTraitTypes, const EFlagmark InFlagmark, FArchive &Archive)
 Construct a new subject record from an archive with the trait types and flagmark supplied explicitly.
 
template<typename AllocatorT >
void SerializeBin (const TArray< UScriptStruct *, AllocatorT > &InTraitTypes, FArchive &Archive)
 Construct a new subject record from an archive with the trait types supplied explicitly.
 

Friends

struct FSubjectInfo
 
class AMechanism
 
class UMachine
 

Detailed Description

A subject packed in a localized container scope.

Unlike usual iterable subjects, the records are allowed to be serialized and authored in the Editor.

These are mainly used as templates (prefabs) when spawning the new subjects.

Constructor & Destructor Documentation

◆ FSubjectRecord() [1/6]

FSubjectRecord::FSubjectRecord ( )
inline

Construct a new empty subject pack.

◆ FSubjectRecord() [2/6]

FSubjectRecord::FSubjectRecord ( const FSubjectRecord InSubjectRecord)
inline

Initialize a subject record as a copy of another one.

◆ FSubjectRecord() [3/6]

FSubjectRecord::FSubjectRecord ( FSubjectRecord &&  InSubjectRecord)
inline

Move-construct a new packed subject.

◆ FSubjectRecord() [4/6]

FSubjectRecord::FSubjectRecord ( const FTraitmark InTraitmark,
const EFlagmark  InFlagmark = FM_None 
)
inline

Construct a new packed subject with a traitmark and a flagmark.

◆ FSubjectRecord() [5/6]

FSubjectRecord::FSubjectRecord ( const FConstSubjectHandle Subject,
const EFlagmark  FlagmarkMask = FM_AllUserLevel 
)
explicit

Construct a new subject record as a copy of an existing subject.

Note
Only user-level flags are copied by default.
Parameters
SubjectA handle for the subject to copy.
FlagmarkMaskA mask for capturing the target subject flagmark. Only user-level flags are copied by default.

◆ FSubjectRecord() [6/6]

FSubjectRecord::FSubjectRecord ( const FConstSubjectHandle Subject,
const FFilter Mask 
)

Construct a new subject record as a copy of an existing subject masked with a filter.

Note
Only user-level flags are copied by default.
Parameters
SubjectA handle for the subject to copy.
MaskA filter used as a mask for including/excluding traits from the Subject.

Member Function Documentation

◆ Contains() [1/2]

template<typename T >
std::enable_if< IsTraitType< T >(), bool >::type FSubjectRecord::Contains ( ) const
inline

Check if the subject record contains a trait of specific type.

Templated version.

Template Parameters
TThe type of the trait to look for.

◆ Contains() [2/2]

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

Check if the subject record contains a trait of specific type.

◆ GetFingerprint()

const FFingerprint & FSubjectRecord::GetFingerprint ( ) const
inline

Get the cached fingerprint of the subject record.

◆ GetFlagmark()

EFlagmark FSubjectRecord::GetFlagmark ( ) const
inline

Get the flagmark of the subject.

◆ GetTraitmark()

const FTraitmark & FSubjectRecord::GetTraitmark ( ) const
inline

Get the cached traitmark of the subject record.

◆ GetTraitPtr() [1/4]

template<typename T >
std::enable_if< IsTraitType< T >(), T * >::type FSubjectRecord::GetTraitPtr ( )
inline

Get the trait's data pointer.

Templated version.

Template Parameters
TThe type of the trait to get a pointer to.

◆ GetTraitPtr() [2/4]

template<typename T >
std::enable_if< IsTraitType< T >(), constT * >::type FSubjectRecord::GetTraitPtr ( ) const
inline

Get the trait's data pointer.

Templated constant version.

Template Parameters
TThe type of the constant trait to get a pointer to.

◆ GetTraitPtr() [3/4]

void * FSubjectRecord::GetTraitPtr ( UScriptStruct *const  TraitType)
inline

Get the trait's data pointer.

◆ GetTraitPtr() [4/4]

const void * FSubjectRecord::GetTraitPtr ( UScriptStruct *const  TraitType) const
inline

Get the trait's data pointer.

Constant version.

◆ GetTraitRef() [1/2]

template<typename T >
std::enable_if< IsTraitType< T >(), T & >::type FSubjectRecord::GetTraitRef ( )
inline

Get the trait's data reference.

Templated version.

Template Parameters
TThe type of the trait to get a reference for.

◆ GetTraitRef() [2/2]

template<typename T >
std::enable_if< IsTraitType< T >(), constT & >::type FSubjectRecord::GetTraitRef ( ) const
inline

Get the trait's data reference.

Templated constant version.

Template Parameters
TThe type of the constant trait to get a reference for.

◆ GetTraits()

const TArray< FTraitRecord > & FSubjectRecord::GetTraits ( ) const
inline

Get the trait records.

◆ HasFlag()

bool FSubjectRecord::HasFlag ( const EFlagmarkBit  InFlag) const
inline

Check if the flagmark bit is set on the subject.

◆ ObtainTraitPtr()

void * FSubjectRecord::ObtainTraitPtr ( UScriptStruct *const  TraitType)
inline

Obtain a trait data pointer by its type.

Warning
The data pointer can change when the new trait records are added.

◆ ObtainTraitRef()

template<typename T >
std::enable_if< IsTraitType< T >(), T & >::type FSubjectRecord::ObtainTraitRef ( )
inline

Obtain a trait data reference by its type.

Templated version.

Warning
The data reference can change when the new trait records are added.
Template Parameters
TThe type of the trait to obtain a reference for.

◆ operator=() [1/2]

FSubjectRecord & FSubjectRecord::operator= ( const FSubjectRecord InSubjectRecord)
inline

Assign the subject record equal to an another record.

◆ operator=() [2/2]

FSubjectRecord & FSubjectRecord::operator= ( FSubjectRecord &&  InSubjectRecord)
inline

Move-assign the subject record from an another one.

◆ PostSerialize()

void FSubjectRecord::PostSerialize ( const FArchive &  Archive)
inline

Post-serialize the record via an archive.

◆ SerializeBin() [1/2]

template<typename AllocatorT >
void FSubjectRecord::SerializeBin ( const TArray< UScriptStruct *, AllocatorT > &  InTraitTypes,
const EFlagmark  InFlagmark,
FArchive &  Archive 
)

Construct a new subject record from an archive with the trait types and flagmark supplied explicitly.

Parameters
InTraitTypesThe supplied trait types.
InFlagmarkThe supplied flagmark.
ArchiveThe serializing archive. Should be opened for loading.

◆ SerializeBin() [2/2]

template<typename AllocatorT >
void FSubjectRecord::SerializeBin ( const TArray< UScriptStruct *, AllocatorT > &  InTraitTypes,
FArchive &  Archive 
)
inline

Construct a new subject record from an archive with the trait types supplied explicitly.

Parameters
InTraitTypesThe supplied trait types.
ArchiveThe serializing archive. Should be opened for loading.

◆ SetFlag()

EApparatusStatus FSubjectRecord::SetFlag ( const EFlagmarkBit  InFlag,
bool  bState = true 
)
inline

Set the flagmark bit for the subject.

◆ SetFlagmark()

EApparatusStatus FSubjectRecord::SetFlagmark ( const EFlagmark  InFlagmark)
inline

Set the flagmark of the subject.

◆ SetTrait()

template<typename T >
std::enable_if< IsTraitType< T >(), EApparatusStatus >::type FSubjectRecord::SetTrait ( const T InTrait)
inline

Set a trait.

Statically typed version.

Template Parameters
TThe type of the trait to set.
Parameters
InTraitThe trait to set to.
Returns
The status of the operation.

◆ TraitAt()

const FTraitRecord & FSubjectRecord::TraitAt ( const int32  Index) const
inline

Get a trait record at specified index.

◆ TraitsNum()

int32 FSubjectRecord::TraitsNum ( ) const
inline

Get the number of traits in the subject.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ FSubjectInfo

friend struct FSubjectInfo
friend

◆ UMachine

friend class UMachine
friend

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