Apparatus Version 1.8
ECS data-oriented 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>

Inheritance diagram for FSubjectHandle:
Inheritance graph
[legend]
Collaboration diagram for FSubjectHandle:
Collaboration graph
[legend]

Public Types

enum  { IsSolid = 0 }
 
typedef ISubjective SubjectiveType
 The compatible type of the subjective used. More...
 
- Public Types inherited from FSubjectHandleBase
enum  { InvalidId = FSubjectInfo::InvalidId , InvalidGeneration = FSubjectInfo::InvalidGeneration }
 

Public Member Functions

EApparatusStatus Despawn () const
 Destroy the subject. More...
 
EApparatusStatus SetTrait (UScriptStruct *TraitType, const void *const TraitData) const
 Set a trait of the subject by its type. More...
 
template<typename T >
EApparatusStatus SetTrait (const T &Trait) const
 Set a trait of the subject. More...
 
EApparatusStatus ObtainTrait (UScriptStruct *TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Obtain a trait from a subject by its type. More...
 
template<typename T >
EApparatusStatus ObtainTrait (T &OutTrait, const bool bTraitDataInitialized=true) const
 Obtain a trait from a subject. More...
 
template<typename T >
ObtainTrait () const
 Obtain a trait from a subject. More...
 
EApparatusStatus RemoveTrait (UScriptStruct *const TraitType) const
 Remove a trait from the subject. More...
 
template<typename T >
EApparatusStatus RemoveTrait () const
 Remove a trait from the subject. More...
 
SubjectiveTypeGetSubjective () const
 Get a subjective this handle is associated with (if any). More...
 
 FSubjectHandle ()
 Construct a new invalid subject handle. More...
 
 FSubjectHandle (const FSubjectHandle &InHandle)
 Copy-construct a new subject handle. More...
 
 FSubjectHandle (const FSubjectHandleBase &InHandle)
 Copy-construct a new subject handle from a base version. More...
 
 FSubjectHandle (const FSolidSubjectHandle &InHandle)
 Copy-construct a new subject handle from a homogenous subject handle. More...
 
 FSubjectHandle (const FConstSubjectHandle &InHandle)
 Copy-construct a new subject handle from an immutable subject handle. More...
 
- Public Member Functions inherited from FSubjectHandleBase
 FSubjectHandleBase ()
 Construct a new invalid base subject handle. More...
 
UMechanismGetMechanism () const
 Get the mechanism of the subject handle. More...
 
void ResetHandle ()
 Clear the subject handle, essentially making it invalid. More...
 
UObject * GetSubjectiveObject () const
 Get a subjective object this handle is associated with (if any). More...
 
FSubjectHandleBaseoperator= (TYPE_OF_NULLPTR)
 Clear the subject handle, essentially making it invalid. More...
 
uint32 CalcHash () const
 Calculate the hash-sum value for the handle. More...
 
const FFingerprintGetFingerprint () const
 Get the fingerprint of the subject. More...
 
bool Matches (const FFilter &InFilter) const
 Check if the subject matches a certain filter. More...
 
bool IsValid () const
 Check if the subject handle is valid and is pointing to an existent subject. More...
 
bool operator== (TYPE_OF_NULLPTR) const
 Check if the subject handle is invalid and is pointing to a non-existent subject. More...
 
bool operator!= (TYPE_OF_NULLPTR) const
 Check if the subject handle is valid and is pointing to an existent subject. More...
 
 operator bool () const
 Check if the subject handle is valid and is pointing to an existent subject. 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...
 
bool EqualsRaw (const FSubjectHandleBase &InSubject) const
 Check if two subject handles are equal byte-wise. More...
 
bool operator== (const FSubjectHandleBase &InSubject) const
 Check if the subject handle points to the same subject as the other one. More...
 
bool operator!= (const FSubjectHandleBase &InSubject) const
 Check if the subject handles point to different subjects. More...
 
EApparatusStatus GetTrait (UScriptStruct *const TraitType, void *const OutTraitData, 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...
 
template<typename T >
GetTrait () const
 Get a trait copy from a subject by its type. More...
 
EApparatusStatus CopyTraitsTo (const FSubjectHandle &DestinationSubjectHandle) const
 Copy the traits to some other subject. More...
 

Static Public Attributes

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

Friends

struct FSubjectInfo
 
struct FSolidSubjectHandle
 
struct FConstSubjectHandle
 
class UChunk
 
class UMechanism
 
class UMachine
 
class ISubjective
 
template<typename ChunkItT , typename BeltItT >
struct TChain
 

Additional Inherited Members

- Protected Member Functions inherited from FSubjectHandleBase
FSubjectInfoFindInfo () const
 Get the valid subject info record (if any). More...
 
FSubjectInfoGetInfo () const
 Get the subject info record associated with it. More...
 
EApparatusStatus MarkBooted () const
 
EApparatusStatus Despawn () const
 Destroy the subject. More...
 
UChunkGetChunk () const
 Get the current chunk of the subject. More...
 
EApparatusStatus SetTrait (UScriptStruct *TraitType, const void *const TraitData) const
 Set a trait of the subject by its type. More...
 
template<typename T >
EApparatusStatus SetTrait (const T &Trait) const
 Set a trait of the subject. More...
 
void * GetTraitPtr (UScriptStruct *const TraitType) const
 Get a pointer to a trait of a certain type. More...
 
template<typename T >
T * GetTraitPtr () const
 Get a pointer to a trait of a certain type. More...
 
template<typename T >
T & GetTraitRef () const
 Get a trait from a subject by its type. More...
 
EApparatusStatus ObtainTrait (UScriptStruct *TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Obtain a trait from a subject by its type. More...
 
template<typename T >
EApparatusStatus ObtainTrait (T &OutTrait, const bool bTraitDataInitialized=true) const
 Obtain a trait from a subject. More...
 
template<typename T >
ObtainTrait () const
 Obtain a trait copy from a subject. More...
 
EApparatusStatus RemoveTrait (UScriptStruct *TraitType) const
 Remove a trait from the subject. More...
 
template<typename T >
EApparatusStatus RemoveTrait () const
 Remove a trait from the subject. More...
 
TScriptInterface< ISubjectiveGetSubjective () const
 Get a subjective this handle is associated with (if any). More...
 
 FSubjectHandleBase (const int32 InId, const int32 InGeneration)
 Construct by explicit id and generation specifications. More...
 
 FSubjectHandleBase (const FSubjectHandleBase &InHandle)
 Copy-construct a new subject handle. More...
 
 FSubjectHandleBase (const FSubjectHandle &InHandle)
 Copy-construct a new subject handle from a mutable subject handle. More...
 
 FSubjectHandleBase (const FSolidSubjectHandle &InHandle)
 Copy-construct a new subject handle from a homogenous subject handle. More...
 
 FSubjectHandleBase (const FConstSubjectHandle &InHandle)
 Copy-construct a new subject handle from an immutable subject handle. More...
 
- Protected Attributes inherited from FSubjectHandleBase
int32 Id = InvalidId
 A unique identifier of the subject within the mechanism. More...
 
int32 Generation = InvalidGeneration
 A unique generation of the subject. More...
 

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 Typedef Documentation

◆ SubjectiveType

The compatible type of the subjective used.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
IsSolid 

Constructor & Destructor Documentation

◆ FSubjectHandle() [1/5]

FSubjectHandle::FSubjectHandle ( )
inline

Construct a new invalid subject handle.

◆ FSubjectHandle() [2/5]

FSubjectHandle::FSubjectHandle ( const FSubjectHandle InHandle)
inline

Copy-construct a new subject handle.

◆ FSubjectHandle() [3/5]

FSubjectHandle::FSubjectHandle ( const FSubjectHandleBase InHandle)
inlineexplicit

Copy-construct a new subject handle from a base version.

◆ FSubjectHandle() [4/5]

FSubjectHandle::FSubjectHandle ( const FSolidSubjectHandle InHandle)
inlineexplicit

Copy-construct a new subject handle from a homogenous subject handle.

◆ FSubjectHandle() [5/5]

FSubjectHandle::FSubjectHandle ( const FConstSubjectHandle InHandle)
inlineexplicit

Copy-construct a new subject handle from an immutable subject handle.

Member Function Documentation

◆ Despawn()

EApparatusStatus FSubjectHandle::Despawn ( ) const
inline

Destroy the subject.

Returns
The status of the operation.

◆ GetSubjective()

SubjectiveType* FSubjectHandle::GetSubjective ( ) const
inline

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

◆ ObtainTrait() [1/3]

template<typename T >
T FSubjectHandle::ObtainTrait ( ) const
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/3]

template<typename T >
EApparatusStatus FSubjectHandle::ObtainTrait ( T &  OutTrait,
const bool  bTraitDataInitialized = true 
) const
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() [3/3]

EApparatusStatus FSubjectHandle::ObtainTrait ( UScriptStruct *  TraitType,
void *const  OutTraitData,
const bool  bTraitDataInitialized = true 
) const
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.
OutTraitDataThe trait data receiver.
bTraitDataInitializedIs the OutTraitData buffer actually initialized?
Returns
The status of the operation.

◆ RemoveTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::RemoveTrait ( ) const
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 *const  TraitType) const
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.

◆ SetTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandle::SetTrait ( const T &  Trait) const
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 
) const
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

◆ FConstSubjectHandle

friend struct FConstSubjectHandle
friend

◆ FSolidSubjectHandle

friend struct FSolidSubjectHandle
friend

◆ FSubjectInfo

friend struct FSubjectInfo
friend

◆ ISubjective

friend class ISubjective
friend

◆ TChain

template<typename ChunkItT , typename BeltItT >
friend struct TChain
friend

◆ UChunk

friend class UChunk
friend

◆ UMachine

friend class UMachine
friend

◆ UMechanism

friend class UMechanism
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: