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

The main entity in the mechanism, consisting of traits. More...

#include <SubjectHandleBase.h>

Inheritance diagram for FSubjectHandleBase:
Inheritance graph
[legend]

Public Types

typedef FSubjectInfo::IdType IdType
 
typedef FSubjectInfo::GenerationType GenerationType
 

Public Member Functions

 FSubjectHandleBase ()
 Construct a new invalid base subject handle. More...
 
int32 GetId () const
 Get the internal unique identifier of the subject. More...
 
AMechanismGetMechanism () const
 Get the mechanism of the subject handle. More...
 
void ResetHandle ()
 Clear the subject handle, essentially making it invalid. 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 current 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 &InSubjectHandle) const
 Check if the subject handle points to the same subject as the other one. More...
 
bool operator!= (const FSubjectHandleBase &InSubjectHandle) 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 >
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 IdType InvalidId = FSubjectInfo::InvalidId
 Invalid subject identifier. More...
 
static const IdType FirstId = FSubjectInfo::FirstId
 A first valid subject identifier. More...
 
static const IdType IdMax = FSubjectInfo::IdMax
 The maximum valid subject identifier. More...
 
static const GenerationType FirstGeneration = FSubjectInfo::FirstGeneration
 The first valid generation. More...
 
static const GenerationType GenerationMax = FSubjectInfo::GenerationMax
 The maximum valid generation. More...
 

Protected Member Functions

FSubjectInfoFindInfo () const
 Get the valid subject info record (if any). More...
 
FSubjectInfoGetInfo () const
 Get the subject info record associated with it. More...
 
FFingerprintGetFingerprintRef () const
 Get the current fingerprint's reference of the subject. More...
 
bool MarkBooted () const
 
UChunkGetChunk () const
 Get the current chunk of the subject. More...
 
void * GetTraitPtr (UScriptStruct *const TraitType) const
 Get a pointer to a trait of a certain type. More...
 
template<typename T >
TGetTraitPtr () const
 Get a pointer to a trait of a certain type. More...
 
template<typename T >
TGetTraitRef () const
 Get a trait from a subject by its type. More...
 
ISubjectiveGetSubjective () const
 Get a subjective this handle is associated with (if any). More...
 
 FSubjectHandleBase (const int32 InId, const GenerationType 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...
 
Despawning
EApparatusStatus Despawn () const
 Destroy the subject. More...
 
EApparatusStatus DespawnDeferred (const bool bHard=true) const
 Destroy the subject. More...
 
Trait Setting
EApparatusStatus SetTrait (UScriptStruct *TraitType, const void *const TraitData) const
 Set a trait of the subject by its type. More...
 
EApparatusStatus SetTrait (const FTraitRecord &TraitRecord) const
 Set a trait of the subject to a trait record. More...
 
template<typename T >
EApparatusStatus SetTrait (const T &Trait) const
 Set a trait of the subject. More...
 
Deferred Trait Settings
EApparatusStatus SetTraitDeferred (UScriptStruct *const TraitType, const void *const TraitData) const
 Set a trait of the subject by its type. More...
 
template<typename T >
EApparatusStatus SetTraitDeferred (const T &Trait) const
 Set a trait of the subject by its type. More...
 
Trait Obtainment
EApparatusStatus ObtainTrait (UScriptStruct *TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Obtain a trait from a subject by its type. More...
 
EApparatusStatus ObtainTrait (UScriptStruct *TraitType) const
 Obtain a trait for 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 >
T ObtainTrait () const
 Obtain a trait copy from a subject. More...
 
EApparatusStatus ObtainTraitDeferred (UScriptStruct *const TraitType) const
 Obtain a trait for a subject by its type. More...
 
template<typename T >
T ObtainTraitDeferred () const
 Obtain a trait copy from a subject. More...
 
Trait Removal
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...
 
EApparatusStatus RemoveAllTraits () const
 Remove all of the traits from the subject (if any). More...
 
Deferred Trait Removal
EApparatusStatus RemoveTraitDeferred (UScriptStruct *const TraitType) const
 Remove a trait from the subject. More...
 
template<typename T >
EApparatusStatus RemoveTraitDeferred () const
 Remove a trait from the subject. More...
 
EApparatusStatus RemoveAllTraitsDeferred () const
 Remove all of the traits from the subject. More...
 

Protected Attributes

int32 Id = InvalidId
 A unique identifier of the subject within the mechanism. More...
 
uint32 Generation = FirstGeneration
 A unique generation of the subject. More...
 

Friends

template<typename ChunkItT , typename BeltItT >
struct TChain
 
template<typename SubjectHandleT >
struct TChunkIt
 
template<typename SubjectHandleT >
struct TBeltIt
 
struct FSubjectInfo
 
struct FSubjectNetworkState
 
struct FSolidSubjectHandle
 
struct FConstSubjectHandle
 
struct FChunkSlot
 
struct FSubjectRecord
 
class UChunk
 
class AMechanism
 
class UMachine
 
class ISubjective
 
class UNetworkBearerComponent
 
class ASubjectiveActor
 
class USubjectiveActorComponent
 

Flagmark

EFlagmark GetFlagmark () const
 Get the flagmark of the subject. More...
 
bool HasFlag (const EFlagmarkBit Flag) const
 Get the state of a certain flag of the subject. More...
 
EFlagmark SetFlagmark (const EFlagmark Flagmark) const
 Set the flagmark of the subject. More...
 
EApparatusStatus SetFlagmark_Status (const EFlagmark Flagmark) const
 Set the flagmark of the subject. More...
 
EFlagmark SetFlagmarkMasked (const EFlagmark Flagmark, const EFlagmark Mask) const
 Set the flagmark of the subject. More...
 
EApparatusStatus SetFlagmarkMasked_Status (const EFlagmark Flagmark, const EFlagmark Mask) const
 Set the flagmark of the subject. More...
 
bool SetFlag (const EFlagmarkBit Flag, const bool bState=true) const
 Set a single flag for the subject. More...
 
EApparatusStatus SetFlag_Status (const EFlagmarkBit Flag, const bool bState=true) const
 Set a single flag for the subject. More...
 
bool ToggleFlag (const EFlagmarkBit Flag) const
 Toggle a single flag for the subject. More...
 

Networking

bool IsOnline () const
 Check if the subject currently networked. More...
 
uint32 GetNetworkId () const
 Get a unique network identifier of a subject (if any). More...
 
bool IsServerSide () const
 Check if this is a server-side version of the subject. More...
 
bool IsClientSide () const
 Check if this is a client-side version of the subject. More...
 
const FTraitmarkGetTraitmarkPass () const
 Get the server-side list of traits allowed to be received from clients. More...
 
EApparatusStatus BringOnline () const
 Make the subject networked. More...
 
EApparatusStatus SetTraitmarkPass (const FTraitmark &InTraitmarkPass) const
 Set the server-side list of traits allowed to be received from clients. More...
 
void PushTrait (UScriptStruct *const TraitType, const void *const TraitData, const bool bSetForLocal=false) const
 Send an additional trait to the remote version of the subject. More...
 
template<typename T >
void PushTrait (const T &Trait, const bool bSetForLocal=false) const
 Send an additional trait to the remote version of the subject. More...
 
void PushTrait (UScriptStruct *const TraitType) const
 Send an existing trait to the remote version of the subject. More...
 
template<typename T >
void PushTrait () const
 Send an additional trait to the remote version of the subject. More...
 

Detailed Description

The main entity in the mechanism, 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 efficiently be passed by value to the methods and functions.

Member Typedef Documentation

◆ GenerationType

◆ IdType

Constructor & Destructor Documentation

◆ FSubjectHandleBase() [1/6]

FSubjectHandleBase::FSubjectHandleBase ( )
inline

Construct a new invalid base subject handle.

◆ FSubjectHandleBase() [2/6]

FSubjectHandleBase::FSubjectHandleBase ( const int32  InId,
const GenerationType  InGeneration 
)
inlineprotected

Construct by explicit id and generation specifications.

Parameters
InIdThe unique subject identifier.
InGenerationThe generation of the subject.

◆ FSubjectHandleBase() [3/6]

FSubjectHandleBase::FSubjectHandleBase ( const FSubjectHandleBase InHandle)
inlineprotected

Copy-construct a new subject handle.

◆ FSubjectHandleBase() [4/6]

FSubjectHandleBase::FSubjectHandleBase ( const FSubjectHandle InHandle)
inlineexplicitprotected

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

◆ FSubjectHandleBase() [5/6]

FSubjectHandleBase::FSubjectHandleBase ( const FSolidSubjectHandle InHandle)
inlineexplicitprotected

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

◆ FSubjectHandleBase() [6/6]

FSubjectHandleBase::FSubjectHandleBase ( const FConstSubjectHandle InHandle)
inlineexplicitprotected

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

Member Function Documentation

◆ BringOnline()

EApparatusStatus FSubjectHandleBase::BringOnline ( ) const
inlineprotected

Make the subject networked.

Server-only method.

This assigns a new, unique, cross-peer identifier to the subject and spawns an empty instance of it on the client(s).

If the subject is already online, nothing is performed.

Returns
The status of the operation.
EApparatusStatus::Noop if the subject is already online.
See also
IsOnline() GetNetworkId()

◆ CalcHash()

uint32 FSubjectHandleBase::CalcHash ( ) const
inline

Calculate the hash-sum value for the handle.

◆ CopyTraitsTo()

EApparatusStatus FSubjectHandleBase::CopyTraitsTo ( const FSubjectHandle DestinationSubjectHandle) const
inline

Copy the traits to some other subject.

The existing traits of the destination subject are not removed but the new ones are added and/or override the existing matching.

Parameters
DestinationSubjectHandleThe destination subject to copy to.
Returns
The status of the operation.

◆ Despawn()

EApparatusStatus FSubjectHandleBase::Despawn ( ) const
inlineprotected

Destroy the subject.

If the handle is not valid, nothing is performed.

Returns
The status of the operation.

◆ DespawnDeferred()

EApparatusStatus FSubjectHandleBase::DespawnDeferred ( const bool  bHard = true) const
inlineprotected

Destroy the subject.

Deferred version.

The actual entity destruction is deferred until the deferreds are applied either automatically or manually.

If the handle is not valid, nothing is performed.

Parameters
bHardShould the hard version of the operation be performed.
Returns
The status of the operation.

◆ EqualsRaw()

bool FSubjectHandleBase::EqualsRaw ( const FSubjectHandleBase InSubject) const
inline

Check if two subject handles are equal byte-wise.

◆ FindInfo()

FSubjectInfo * FSubjectHandleBase::FindInfo ( ) const
inlineprotected

Get the valid subject info record (if any).

The subject handle gets invalidated if the information is not found.

Returns
A valid subject registry information or nullptr, if the subject handle points to an invalid subject.

◆ GetChunk()

UChunk * FSubjectHandleBase::GetChunk ( ) const
inlineprotected

Get the current chunk of the subject.

Returns
A chunk, this subject is currently part of. Returns nullptr, if there is none.

◆ GetFingerprint()

const FFingerprint & FSubjectHandleBase::GetFingerprint ( ) const
inline

Get the current fingerprint of the subject.

◆ GetFingerprintRef()

FFingerprint & FSubjectHandleBase::GetFingerprintRef ( ) const
inlineprotected

Get the current fingerprint's reference of the subject.

◆ GetFlagmark()

EFlagmark FSubjectHandleBase::GetFlagmark ( ) const
inline

Get the flagmark of the subject.

◆ GetId()

int32 FSubjectHandleBase::GetId ( ) const
inline

Get the internal unique identifier of the subject.

◆ GetInfo()

FSubjectInfo & FSubjectHandleBase::GetInfo ( ) const
inlineprotected

Get the subject info record associated with it.

◆ GetMechanism()

AMechanism * FSubjectHandleBase::GetMechanism ( ) const
inline

Get the mechanism of the subject handle.

◆ GetNetworkId()

uint32 FSubjectHandleBase::GetNetworkId ( ) const
inline

Get a unique network identifier of a subject (if any).

This unique identifier clearly and unequivocally identifies a subject within multiple peers (client(s) and server) and is used internally to address the subject in the networking environment.

Returns
The unique cross-peer identifier of the subject or FSubjectNetworkState::InvalidId, if the subject is not online just yet.
See also
IsOnline() BringOnline()

◆ GetSubjective()

ISubjective * FSubjectHandleBase::GetSubjective ( ) const
inlineprotected

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

Subjectives are high-level UObject-compatible entities. The method is non-public, cause a cast to a specific version is actually in the child struct.

◆ GetTrait() [1/3]

template<typename T >
T FSubjectHandleBase::GetTrait ( ) const
inline

Get a trait copy from a subject by its type.

Template Parameters
TThe type of the trait to get.
Returns
A copy of the trait.

◆ GetTrait() [2/3]

template<typename T >
EApparatusStatus FSubjectHandleBase::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() [3/3]

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

Get a trait from a subject by its type.

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

◆ GetTraitmarkPass()

const FTraitmark & FSubjectHandleBase::GetTraitmarkPass ( ) const
inline

Get the server-side list of traits allowed to be received from clients.

Can only be queried from a server-side subject.

See also
SetTraitmarkPass()

◆ GetTraitPtr() [1/2]

template<typename T >
T * FSubjectHandleBase::GetTraitPtr ( ) const
inlineprotected

Get a pointer to a trait of a certain type.

Templated version.

Template Parameters
TThe type of the trait to get.
Returns
A pointer to the trait data.

◆ GetTraitPtr() [2/2]

void * FSubjectHandleBase::GetTraitPtr ( UScriptStruct *const  TraitType) const
inlineprotected

Get a pointer to a trait of a certain type.

Parameters
TraitTypeThe type of the trait to get.
Returns
A pointer to the trait data.

◆ GetTraitRef()

template<typename T >
T & FSubjectHandleBase::GetTraitRef ( ) const
inlineprotected

Get a trait from a subject by its type.

Templated version.

Template Parameters
TThe type of the trait to get.
Returns
A reference to the trait data.

◆ HasDetail() [1/2]

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

Check if the subject has a certain detail.

Templated version.

◆ HasDetail() [2/2]

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

Check if the subject has a certain detail.

◆ HasFlag()

bool FSubjectHandleBase::HasFlag ( const EFlagmarkBit  Flag) const
inline

Get the state of a certain flag of the subject.

Always returns false for invalid subject handles.

Parameters
FlagThe flag to examine.
Returns
The state of the flag.

◆ HasTrait() [1/2]

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

Check if the subject has a certain trait.

Templated version.

◆ HasTrait() [2/2]

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

Check if the subject has a certain trait.

◆ IsClientSide()

bool FSubjectHandleBase::IsClientSide ( ) const
inline

Check if this is a client-side version of the subject.

A subject must be both online and be part of a client world's mechanism in order to be considered client-side.

See also
IsOnline() IsServerSide()

◆ IsOnline()

bool FSubjectHandleBase::IsOnline ( ) const
inline

Check if the subject currently networked.

Networked subject can receive and push traits over the network to the remote versions of themselves.

See also
GetNetworkId() BringOnline()

◆ IsServerSide()

bool FSubjectHandleBase::IsServerSide ( ) const
inline

Check if this is a server-side version of the subject.

A subject must be both online and be part of a server world's mechanism in order to be considered server-side.

See also
IsOnline() IsClientSide()

◆ IsValid()

bool FSubjectHandleBase::IsValid ( ) const
inline

Check if the subject handle is valid and is pointing to an existent subject.

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

◆ MarkBooted()

bool FSubjectHandleBase::MarkBooted ( ) const
inlineprotected

◆ Matches()

bool FSubjectHandleBase::Matches ( const FFilter InFilter) const
inline

Check if the subject matches a certain filter.

◆ ObtainTrait() [1/4]

template<typename T >
T FSubjectHandleBase::ObtainTrait ( ) const
inlineprotected

Obtain a trait copy from a subject.

Templated version.

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

Template Parameters
TThe type of the trait to obtain.
Returns
A copy of the trait.

◆ ObtainTrait() [2/4]

template<typename T >
EApparatusStatus FSubjectHandleBase::ObtainTrait ( T OutTrait,
const bool  bTraitDataInitialized = true 
) const
inlineprotected

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

EApparatusStatus FSubjectHandleBase::ObtainTrait ( UScriptStruct *  TraitType) const
inlineprotected

Obtain a trait for a subject by its type.

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

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

◆ ObtainTrait() [4/4]

EApparatusStatus FSubjectHandleBase::ObtainTrait ( UScriptStruct *  TraitType,
void *const  OutTraitData,
const bool  bTraitDataInitialized = true 
) const
inlineprotected

Obtain a trait from a subject by its type.

If the trait is not currently within the subject, it gets created anew and 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.

◆ ObtainTraitDeferred() [1/2]

template<typename T >
T FSubjectHandleBase::ObtainTraitDeferred
inlineprotected

Obtain a trait copy from a subject.

Templated deferred version.

If the trait is currently missing in the subject, its default value is returned.

The actual change (if any) is deferred until the deferreds are applied either automatically or manually.

Template Parameters
TThe type of the trait to obtain.
Returns
A copy of the trait.

◆ ObtainTraitDeferred() [2/2]

EApparatusStatus FSubjectHandleBase::ObtainTraitDeferred ( UScriptStruct *const  TraitType) const
inlineprotected

Obtain a trait for a subject by its type.

Deferred version.

The actual change (if any) is deferred until the deferreds are applied either automatically or manually.

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

◆ operator bool()

FSubjectHandleBase::operator bool ( ) const
inline

Check if the subject handle is valid and is pointing to an existent subject.

Returns
Returns true if the subject is valid. Otherwise, false is returned.
See also
IsValid()

◆ operator!=() [1/2]

bool FSubjectHandleBase::operator!= ( const FSubjectHandleBase InSubjectHandle) const
inline

Check if the subject handles point to different subjects.

Two invalid subject handles are considered to be the same and this operator would return false.

Parameters
InSubjectHandleA subject handle to compare with.
Returns
true if the handles point to different subjects or one is invalid.
false if the handles point to the same subject or both are invalid.

◆ operator!=() [2/2]

bool FSubjectHandleBase::operator!= ( TYPE_OF_NULLPTR  ) const
inline

Check if the subject handle is valid and is pointing to an existent subject.

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

◆ operator=()

FSubjectHandleBase & FSubjectHandleBase::operator= ( TYPE_OF_NULLPTR  )
inline

Clear the subject handle, essentially making it invalid.

◆ operator==() [1/2]

bool FSubjectHandleBase::operator== ( const FSubjectHandleBase InSubjectHandle) const
inline

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

If both handles are invalid, returns true

Parameters
InSubjectHandleA subject handle to compare with.
Returns
true if the handles point to the same subject or both are invalid.
false if the handles point to different subjects or one is invalid.

◆ operator==() [2/2]

bool FSubjectHandleBase::operator== ( TYPE_OF_NULLPTR  ) const
inline

Check if the subject handle is invalid and is pointing to a non-existent subject.

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

◆ PushTrait() [1/4]

template<typename T >
void FSubjectHandleBase::PushTrait
inlineprotected

Send an additional trait to the remote version of the subject.

The trait can be sent both from the client's version to the server's and from the server's version to the client(s)'.

When pushing from the server, the trait gets broadcasted to all of the available clients (if any). The subject is brought online automatically, if needed.

When pushing from the client, the server will apply the trait only if it's in the traitmark pass of the server's version.

Parameters
TraitTypeThe type of the trait to send. Must not be a nullptr.
TraitDataThe data of the trait to send. Must not be a nullptr.
bSetForLocalShould a trait also be set for a local version?
See also
SetTraitmarkPass()

◆ PushTrait() [2/4]

template<typename T >
void FSubjectHandleBase::PushTrait ( const T Trait,
const bool  bSetForLocal = false 
) const
inlineprotected

Send an additional trait to the remote version of the subject.

Templated version.

The trait can be sent both from the client's version to the server's and from the server's version to the client(s)'.

When pushing from the server, the trait gets broadcasted to all of the available clients (if any). The subject is brought online automatically, if needed.

When pushing from the client, the server will apply the trait only if it's in the traitmark pass of the server's version.

Template Parameters
TThe type of the trait to send.
Parameters
TraitThe trait to send.
bSetForLocalShould a trait also be set for self?

◆ PushTrait() [3/4]

void FSubjectHandleBase::PushTrait ( UScriptStruct *const  TraitType) const
inlineprotected

Send an existing trait to the remote version of the subject.

If the trait is not within the subject, it is added automatically. The trait can be sent both from the client's version to the server's and from the server's version to the client(s)'.

When pushing from the server, the trait gets broadcasted to all of the available clients (if any). The subject is brought online automatically, if needed.

When pushing from the client, the server will apply the trait only if it's in the traitmark pass of the server's version.

Parameters
TraitTypeThe type of the trait to push. Must not be a nullptr.

◆ PushTrait() [4/4]

void FSubjectHandleBase::PushTrait ( UScriptStruct *const  TraitType,
const void *const  TraitData,
const bool  bSetForLocal = false 
) const
inlineprotected

Send an additional trait to the remote version of the subject.

The trait can be sent both from the client's version to the server's and from the server's version to the client(s)'.

When pushing from the server, the trait gets broadcasted to all of the available clients (if any). The subject is brought online automatically, if needed.

When pushing from the client, the server will apply the trait only if it's in the traitmark pass of the server's version.

Parameters
TraitTypeThe type of the trait to send. Must not be a nullptr.
TraitDataThe data of the trait to send. Must not be a nullptr.
bSetForLocalShould a trait also be set for a local version?
See also
SetTraitmarkPass()

◆ RemoveAllTraits()

EApparatusStatus FSubjectHandleBase::RemoveAllTraits ( ) const
inlineprotected

Remove all of the traits from the subject (if any).

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

Returns
The status of the operation.

◆ RemoveAllTraitsDeferred()

EApparatusStatus FSubjectHandleBase::RemoveAllTraitsDeferred ( ) const
inlineprotected

Remove all of the traits from the subject.

Deferred version.

The actual change is deferred until the deferreds are applied either automatically or manually.

Returns
The status of the operation.

◆ RemoveTrait() [1/2]

template<typename T >
EApparatusStatus FSubjectHandleBase::RemoveTrait ( ) const
inlineprotected

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 FSubjectHandleBase::RemoveTrait ( UScriptStruct *const  TraitType) const
inlineprotected

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.

◆ RemoveTraitDeferred() [1/2]

template<typename T >
EApparatusStatus FSubjectHandleBase::RemoveTraitDeferred ( ) const
inlineprotected

Remove a trait from the subject.

Templated deferred version.

The actual change is deferred until the deferreds are applied either automatically or manually.

If at the time of performing the operation, the trait is not within the subject, nothing gets performed.

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

◆ RemoveTraitDeferred() [2/2]

EApparatusStatus FSubjectHandleBase::RemoveTraitDeferred ( UScriptStruct *const  TraitType) const
inlineprotected

Remove a trait from the subject.

Deferred version.

The actual change is deferred until the deferreds are applied either automatically or manually.

If at the time of performing the operation, the trait is not within the subject, nothing gets performed.

Parameters
TraitTypeThe type of the trait to remove. If nullptr, nothing is performed.
Returns
The status of the operation.

◆ ResetHandle()

void FSubjectHandleBase::ResetHandle ( )
inline

Clear the subject handle, essentially making it invalid.

◆ SetFlag()

bool FSubjectHandleBase::SetFlag ( const EFlagmarkBit  Flag,
const bool  bState = true 
) const
inlineprotected

Set a single flag for the subject.

This is a user-level method. Setting of the system-level flags is strictly prohibited.

The operation is atomic and thread-safe.

Parameters
FlagThe flag to set.
bStateThe state to set to.
Returns
The previous state of the flag.

◆ SetFlag_Status()

EApparatusStatus FSubjectHandleBase::SetFlag_Status ( const EFlagmarkBit  Flag,
const bool  bState = true 
) const
inlineprotected

Set a single flag for the subject.

Status version.

This is a user-level method. Setting of the system-level flags is strictly prohibited.

The operation is atomic and thread-safe.

Parameters
FlagThe flag to set.
bStateThe state to set to.
Returns
The status of the operation.

◆ SetFlagmark()

EFlagmark FSubjectHandleBase::SetFlagmark ( const EFlagmark  Flagmark) const
inlineprotected

Set the flagmark of the subject.

This is a user-level method that prevents setting the system-level flags.

This operation is atomic and thread-safe.

Parameters
FlagmarkThe flagmark to set. The system-level bits are silently ignored.
Returns
The previous flagmark of the subject.

◆ SetFlagmark_Status()

EApparatusStatus FSubjectHandleBase::SetFlagmark_Status ( const EFlagmark  Flagmark) const
inlineprotected

Set the flagmark of the subject.

Status version.

This is a user-level method that prevents setting the system-level flags.

This operation is atomic and thread-safe.

Parameters
FlagmarkThe flagmark to set. The system-level bits are silently ignored.
Returns
The status of the operation.

◆ SetFlagmarkMasked()

EFlagmark FSubjectHandleBase::SetFlagmarkMasked ( const EFlagmark  Flagmark,
const EFlagmark  Mask 
) const
inlineprotected

Set the flagmark of the subject.

This is a user-level method that prevents setting the system-level flags.

This operation is atomic and thread-safe.

Parameters
FlagmarkThe flagmark to set.
MaskThe mask to use.
Returns
The previous flagmark of the subject

◆ SetFlagmarkMasked_Status()

EApparatusStatus FSubjectHandleBase::SetFlagmarkMasked_Status ( const EFlagmark  Flagmark,
const EFlagmark  Mask 
) const
inlineprotected

Set the flagmark of the subject.

Status version.

This is a user-level method that prevents setting the system-level flags.

This operation is atomic and thread-safe.

Parameters
FlagmarkThe flagmark to set.
MaskThe mask to use.
Returns
The status of the operation.

◆ SetTrait() [1/3]

EApparatusStatus FSubjectHandleBase::SetTrait ( const FTraitRecord &  TraitRecord) const
inlineprotected

Set a trait of the subject to a trait record.

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

Parameters
TraitRecordThe trait record to set to.
Returns
The status of the operation.

◆ SetTrait() [2/3]

template<typename T >
EApparatusStatus FSubjectHandleBase::SetTrait ( const T Trait) const
inlineprotected

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() [3/3]

EApparatusStatus FSubjectHandleBase::SetTrait ( UScriptStruct *  TraitType,
const void *const  TraitData 
) const
inlineprotected

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.

◆ SetTraitDeferred() [1/2]

template<typename T >
EApparatusStatus FSubjectHandleBase::SetTraitDeferred ( const T Trait) const
inlineprotected

Set a trait of the subject by its type.

Deferred templated version.

The actual change is deferred until the deferreds are applied either automatically or manually.

At the time of performing the operation, if the trait is not currently within the subject, it gets created anew and set accordingly.

Template Parameters
TThe type of the trait to add.
Parameters
TraitThe trait to initialize with.
Returns
The status of the operation.

◆ SetTraitDeferred() [2/2]

EApparatusStatus FSubjectHandleBase::SetTraitDeferred ( UScriptStruct *const  TraitType,
const void *const  TraitData 
) const
inlineprotected

Set a trait of the subject by its type.

Deferred version.

The actual change is deferred until the deferreds are applied either automatically or manually.

At the time of performing the operation, 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.

◆ SetTraitmarkPass()

EApparatusStatus FSubjectHandleBase::SetTraitmarkPass ( const FTraitmark InTraitmarkPass) const
inlineprotected

Set the server-side list of traits allowed to be received from clients.

Can only be set for a server-side subject.

See also
GetTraitmarkPass()

◆ ToggleFlag()

bool FSubjectHandleBase::ToggleFlag ( const EFlagmarkBit  Flag) const
inlineprotected

Toggle a single flag for the subject.

This is a user-level method. Changing a system-level flag is strictly prohibited.

The operation is atomic and thread-safe.

Parameters
FlagThe flag to toggle.
Returns
The previous state of the flag.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ ASubjectiveActor

friend class ASubjectiveActor
friend

◆ FChunkSlot

friend struct FChunkSlot
friend

◆ FConstSubjectHandle

friend struct FConstSubjectHandle
friend

◆ FSolidSubjectHandle

friend struct FSolidSubjectHandle
friend

◆ FSubjectInfo

friend struct FSubjectInfo
friend

◆ FSubjectNetworkState

friend struct FSubjectNetworkState
friend

◆ FSubjectRecord

friend struct FSubjectRecord
friend

◆ ISubjective

friend class ISubjective
friend

◆ TBeltIt

template<typename SubjectHandleT >
friend struct TBeltIt
friend

◆ TChain

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

◆ TChunkIt

template<typename SubjectHandleT >
friend struct TChunkIt
friend

◆ UChunk

friend class UChunk
friend

◆ UMachine

friend class UMachine
friend

◆ UNetworkBearerComponent

friend class UNetworkBearerComponent
friend

◆ USubjectiveActorComponent

friend class USubjectiveActorComponent
friend

Member Data Documentation

◆ FirstGeneration

const GenerationType FSubjectHandleBase::FirstGeneration = FSubjectInfo::FirstGeneration
static

The first valid generation.

◆ FirstId

const IdType FSubjectHandleBase::FirstId = FSubjectInfo::FirstId
static

A first valid subject identifier.

◆ Generation

uint32 FSubjectHandleBase::Generation = FirstGeneration
protected

A unique generation of the subject.

Used to validate the subject against reused slots.

◆ GenerationMax

const GenerationType FSubjectHandleBase::GenerationMax = FSubjectInfo::GenerationMax
static

The maximum valid generation.

◆ Id

int32 FSubjectHandleBase::Id = InvalidId
protected

A unique identifier of the subject within the mechanism.

If this identifier is invalid, the handle is considered to be invalid.

◆ IdMax

const IdType FSubjectHandleBase::IdMax = FSubjectInfo::IdMax
static

The maximum valid subject identifier.

◆ InvalidId

const IdType FSubjectHandleBase::InvalidId = FSubjectInfo::InvalidId
static

Invalid subject identifier.


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