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

The main entity of the Apparatus, consisting of traits. More...

#include <SubjectHandle.h>

Collaboration diagram for FSubjectHandle:
Collaboration graph
[legend]

Public Types

enum  { InvalidId = FSubjectInfo::InvalidId , InvalidGeneration = FSubjectInfo::InvalidGeneration }
 

Public Member Functions

EApparatusStatus Despawn ()
 Destroy the subject. More...
 
bool Contains (const UScriptStruct *TraitType) const
 Check if a subject contains a trait. More...
 
class UChunkGetChunk () const
 Get the current chunk of the subject. More...
 
bool IsValid () const
 Check if the subject is valid. More...
 
 operator bool () const
 Check if the subject is valid. More...
 
EApparatusStatus SetTrait (UScriptStruct *TraitType, const void *const TraitData)
 Set a trait of the subject by its type. More...
 
template<typename T >
EApparatusStatus SetTrait (const T &Trait)
 Set a trait of the subject. More...
 
EApparatusStatus GetTrait (UScriptStruct *TraitType, void *const TraitData, const bool bTraitDataInitialized=true) const
 Get a trait from a subject by its type. More...
 
template<typename T >
EApparatusStatus GetTrait (T &OutTrait, const bool bTraitDataInitialized=true) const
 Get a trait from a subject by its type. More...
 
EApparatusStatus ObtainTrait (UScriptStruct *TraitType, void *const TraitData, const bool bTraitDataInitialized=true)
 Obtain a trait from a subject by its type. More...
 
template<typename T >
EApparatusStatus ObtainTrait (T &OutTrait, const bool bTraitDataInitialized=true)
 Obtain a trait from a subject. More...
 
EApparatusStatus RemoveTrait (UScriptStruct *TraitType)
 Remove a trait from the subject. More...
 
template<typename T >
EApparatusStatus RemoveTrait ()
 Remove a trait from the subject. More...
 
bool operator== (const FSubjectHandle &InSubject) const
 Check if the subject handle points to the same subject as the other one. More...
 
bool operator!= (const FSubjectHandle &InSubject) const
 Check if the subject handles point to different subjects. More...
 
bool HasTrait (UScriptStruct *const TraitType) const
 Check if the subject has a certain trait. More...
 
template<typename T >
bool HasTrait () const
 Check if the subject has a certain trait. More...
 
bool HasDetail (TSubclassOf< UDetail > DetailClass) const
 Check if the subject has a certain detail. More...
 
template<typename T >
bool HasDetail () const
 Check if the subject has a certain detail. More...
 
TScriptInterface< ISubjectiveGetSubjective () const
 Get a subjective this handle is associated with (if any). More...
 
void ResetHandle () const
 Clear the subject handle, essentially making it invalid. More...
 
uint32 CalcHash () const
 Calculate the hash-sum value for the handle. More...
 

Static Public Attributes

static const FSubjectHandle Invalid
 A global constant for an invalid (NULL) subject handle. More...
 

Friends

struct FSubjectInfo
 
struct FChunkChain
 
class UChunk
 
class UMachine
 
class ISubjective
 

Detailed Description

The main entity of the Apparatus, consisting of traits.

This is a user-level handle structure, something like a pointer. The size of this structure is exactly 64-bit and may be passed by value.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidId 

Invalid subject identifier.

InvalidGeneration 

Invalid subject generation.

Member Function Documentation

◆ CalcHash()

uint32 FSubjectHandle::CalcHash ( ) const
inline

Calculate the hash-sum value for the handle.

◆ Contains()

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

Check if a subject contains a trait.

Parameters
TraitTypeA trait to check for.
Returns
true If the trait exists in the subject.
false If there is no such trait in the subject.

◆ Despawn()

EApparatusStatus FSubjectHandle::Despawn ( )

Destroy the subject.

Returns
The status of the operation.

◆ GetChunk()

UChunk * FSubjectHandle::GetChunk ( ) const
inline

Get the current chunk of the subject.

Returns
A chunk, this subject is part of.

◆ GetSubjective()

TScriptInterface<ISubjective> FSubjectHandle::GetSubjective ( ) const
inline

Get a subjective this handle is associated with (if any).

◆ GetTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::GetTrait ( T &  OutTrait,
const bool  bTraitDataInitialized = true 
) const
inline

Get a trait from a subject by its type.

Templated version.

Template Parameters
TThe type of the trait to get.
Parameters
OutTraitThe trait receiver.
bTraitDataInitializedIs the OutTrait actually initialized?
Returns
The status of the operation.

◆ GetTrait() [2/2]

EApparatusStatus FSubjectHandle::GetTrait ( UScriptStruct *  TraitType,
void *const  TraitData,
const bool  bTraitDataInitialized = true 
) const
inline

Get a trait from a subject by its type.

Parameters
TraitTypeThe type of the trait to get.
TraitDataThe trait data receiver.
bTraitDataInitializedIs the TraitData buffer actually initialized?
Returns
The status of the operation.

◆ HasDetail() [1/2]

template<typename T >
bool FSubjectHandle::HasDetail ( ) const
inline

Check if the subject has a certain detail.

Templated version.

◆ HasDetail() [2/2]

bool FSubjectHandle::HasDetail ( TSubclassOf< UDetail DetailClass) const
inline

Check if the subject has a certain detail.

◆ HasTrait() [1/2]

template<typename T >
bool FSubjectHandle::HasTrait ( ) const
inline

Check if the subject has a certain trait.

Templated version.

◆ HasTrait() [2/2]

bool FSubjectHandle::HasTrait ( UScriptStruct *const  TraitType) const
inline

Check if the subject has a certain trait.

◆ IsValid()

bool FSubjectHandle::IsValid ( ) const
inline

Check if the subject is valid.

Returns
Returns true if the subject is valid. Otherwise, false is returned.

◆ ObtainTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::ObtainTrait ( T &  OutTrait,
const bool  bTraitDataInitialized = true 
)
inline

Obtain a trait from a subject.

Templated version.

If the trait is not currently within the subject, it gets created anew and the default value gets copied to the receiver.

Template Parameters
TThe type of the trait to obtain.
Parameters
OutTraitThe trait receiver.
bTraitDataInitializedIs the OutTrait actually initialized?
Returns
The status of the operation.

◆ ObtainTrait() [2/2]

EApparatusStatus FSubjectHandle::ObtainTrait ( UScriptStruct *  TraitType,
void *const  TraitData,
const bool  bTraitDataInitialized = true 
)
inline

Obtain a trait from a subject by its type.

If the trait is not currently within the subject, it gets created anewand the default value gets copied to the receiver.

Parameters
TraitTypeThe type of the trait to obtain.
TraitDataThe trait data receiver.
bTraitDataInitializedIs the TraitData buffer actually initialized?
Returns
The status of the operation.

◆ operator bool()

FSubjectHandle::operator bool ( ) const
inline

Check if the subject is valid.

Returns
Returns true if the subject is valid. Otherwise, false is returned.

◆ operator!=()

bool FSubjectHandle::operator!= ( const FSubjectHandle InSubject) const
inline

Check if the subject handles point to different subjects.

◆ operator==()

bool FSubjectHandle::operator== ( const FSubjectHandle InSubject) const
inline

Check if the subject handle points to the same subject as the other one.

◆ RemoveTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::RemoveTrait ( )
inline

Remove a trait from the subject.

Templated version.

If there is no such trait in the subject, nothing is performed and EApparatusStatus::Noop is returned.

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

◆ RemoveTrait() [2/2]

EApparatusStatus FSubjectHandle::RemoveTrait ( UScriptStruct *  TraitType)
inline

Remove a trait from the subject.

If there is no such trait in the subject, nothing is performed and EApparatusStatus::Noop is returned.

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

◆ ResetHandle()

void FSubjectHandle::ResetHandle ( ) const
inline

Clear the subject handle, essentially making it invalid.

◆ SetTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::SetTrait ( const T &  Trait)
inline

Set a trait of the subject.

Templated version.

If the trait is not currently within the subject, it gets created anew and set accordingly.

Template Parameters
TA type of the trait to add.
Parameters
TraitA trait to initialize with.
Returns
The status of the operation.

◆ SetTrait() [2/2]

EApparatusStatus FSubjectHandle::SetTrait ( UScriptStruct *  TraitType,
const void *const  TraitData 
)
inline

Set a trait of the subject by its type.

If the trait is not currently within the subject, it gets created anew and set accordingly

Parameters
TraitTypeThe type of the trait to add.
TraitDataThe trait data to initialize with.
Returns
The status of the operation.

Friends And Related Function Documentation

◆ FChunkChain

friend struct FChunkChain
friend

◆ FSubjectInfo

friend struct FSubjectInfo
friend

◆ ISubjective

friend class ISubjective
friend

◆ UChunk

friend class UChunk
friend

◆ UMachine

friend class UMachine
friend

Member Data Documentation

◆ Invalid

const FSubjectHandle FSubjectHandle::Invalid
static

A global constant for an invalid (NULL) subject handle.


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