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

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/5]

FSubjectRecord::FSubjectRecord ( )
inline

Construct a new empty subject pack.

◆ FSubjectRecord() [2/5]

FSubjectRecord::FSubjectRecord ( const FSubjectRecord InSubjectRecord)
inline

Initialize a subject record as a copy of another one.

◆ FSubjectRecord() [3/5]

FSubjectRecord::FSubjectRecord ( FSubjectRecord &&  InSubjectRecord)
inline

Move-construct a new packed subject.

◆ FSubjectRecord() [4/5]

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

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

◆ FSubjectRecord() [5/5]

FSubjectRecord::FSubjectRecord ( const FSolidSubjectHandle Subject,
const EFlagmark  FlagmarkMask = FM_AllUserLevel 
)
inlineexplicit

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.

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 
)
inline

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.

Templated version.

Template Parameters
TThe type of the trait to set.

◆ 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 files: