Apparatus
Version 1.19
ECS data-oriented workflow for Unreal Engine.
|
The main entity in the mechanism, consisting of traits. More...
#include <SubjectHandleBase.h>
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... | |
AMechanism * | GetMechanism () const |
Get the mechanism of the subject handle. More... | |
void | ResetHandle () |
Clear the subject handle, essentially making it invalid. More... | |
FSubjectHandleBase & | operator= (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 FFingerprint & | GetFingerprint () 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 | |
FSubjectInfo * | FindInfo () const |
Get the valid subject info record (if any). More... | |
FSubjectInfo & | GetInfo () const |
Get the subject info record associated with it. More... | |
FFingerprint & | GetFingerprintRef () const |
Get the current fingerprint's reference of the subject. More... | |
bool | MarkBooted () const |
UChunk * | GetChunk () 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 > | |
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... | |
ISubjective * | GetSubjective () 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 FTraitmark & | GetTraitmarkPass () 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... | |
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.
|
inline |
Construct a new invalid base subject handle.
|
inlineprotected |
Construct by explicit id and generation specifications.
InId | The unique subject identifier. |
InGeneration | The generation of the subject. |
|
inlineprotected |
Copy-construct a new subject handle.
|
inlineexplicitprotected |
Copy-construct a new subject handle from a mutable subject handle.
|
inlineexplicitprotected |
Copy-construct a new subject handle from a homogenous subject handle.
|
inlineexplicitprotected |
Copy-construct a new subject handle from an immutable subject handle.
|
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.
|
inline |
Calculate the hash-sum value for the handle.
|
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.
DestinationSubjectHandle | The destination subject to copy to. |
|
inlineprotected |
Destroy the subject.
If the handle is not valid, nothing is performed.
|
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.
bHard | Should the hard version of the operation be performed. |
|
inline |
Check if two subject handles are equal byte-wise.
|
inlineprotected |
Get the valid subject info record (if any).
The subject handle gets invalidated if the information is not found.
nullptr
, if the subject handle points to an invalid subject.
|
inlineprotected |
Get the current chunk of the subject.
nullptr
, if there is none.
|
inline |
Get the current fingerprint of the subject.
|
inlineprotected |
Get the current fingerprint's reference of the subject.
|
inline |
Get the flagmark of the subject.
|
inline |
Get the internal unique identifier of the subject.
|
inlineprotected |
Get the subject info record associated with it.
|
inline |
Get the mechanism of the subject handle.
|
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.
|
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.
Get a trait copy from a subject by its type.
T | The type of the trait to get. |
|
inline |
Get a trait from a subject by its type.
Templated version.
T | The type of the trait to get. |
OutTrait | The trait receiver. |
bTraitDataInitialized | Is the OutTrait actually initialized? |
|
inline |
Get a trait from a subject by its type.
TraitType | The type of the trait to get. |
OutTraitData | The trait data receiver. |
bTraitDataInitialized | Is the OutTraitData buffer actually initialized? |
|
inline |
Get the server-side list of traits allowed to be received from clients.
Can only be queried from a server-side subject.
Get a pointer to a trait of a certain type.
Templated version.
T | The type of the trait to get. |
|
inlineprotected |
Get a pointer to a trait of a certain type.
TraitType | The type of the trait to get. |
Get a trait from a subject by its type.
Templated version.
T | The type of the trait to get. |
|
inline |
Check if the subject has a certain detail.
Templated version.
|
inline |
Check if the subject has a certain detail.
|
inline |
Get the state of a certain flag of the subject.
Always returns false
for invalid subject handles.
Flag | The flag to examine. |
|
inline |
Check if the subject has a certain trait.
Templated version.
|
inline |
Check if the subject has a certain trait.
|
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.
|
inline |
Check if the subject currently networked.
Networked subject can receive and push traits over the network to the remote versions of themselves.
|
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.
|
inline |
Check if the subject handle is valid and is pointing to an existent subject.
true
if the subject is valid. Otherwise, false
is returned.
|
inlineprotected |
|
inline |
Check if the subject matches a certain filter.
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.
T | The type of the trait to obtain. |
|
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.
T | The type of the trait to obtain. |
OutTrait | The trait receiver. |
bTraitDataInitialized | Is the OutTrait actually initialized? |
|
inlineprotected |
Obtain a trait for a subject by its type.
If the trait is not currently within the subject, it gets created anew.
TraitType | The type of the trait to obtain. |
|
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.
TraitType | The type of the trait to obtain. |
OutTraitData | The trait data receiver. |
bTraitDataInitialized | Is the OutTraitData buffer actually initialized? |
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.
T | The type of the trait to obtain. |
|
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.
TraitType | The type of the trait to obtain. |
|
inline |
Check if the subject handle is valid and is pointing to an existent subject.
true
if the subject is valid. Otherwise, false
is returned.
|
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
.
InSubjectHandle | A subject handle to compare with. |
|
inline |
Check if the subject handle is valid and is pointing to an existent subject.
true
if the subject is valid. Otherwise, false
is returned.
|
inline |
Clear the subject handle, essentially making it invalid.
|
inline |
Check if the subject handle points to the same subject as the other one.
If both handles are invalid, returns true
InSubjectHandle | A subject handle to compare with. |
|
inline |
Check if the subject handle is invalid and is pointing to a non-existent subject.
true
if the subject is invalid. Otherwise, false
is returned.
|
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.
TraitType | The type of the trait to send. Must not be a nullptr . |
TraitData | The data of the trait to send. Must not be a nullptr . |
bSetForLocal | Should a trait also be set for a local version? |
|
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.
T | The type of the trait to send. |
Trait | The trait to send. |
bSetForLocal | Should a trait also be set for self? |
|
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.
TraitType | The type of the trait to push. Must not be a nullptr . |
|
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.
TraitType | The type of the trait to send. Must not be a nullptr . |
TraitData | The data of the trait to send. Must not be a nullptr . |
bSetForLocal | Should a trait also be set for a local version? |
|
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.
|
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.
|
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.
T | The type of the trait to remove. |
|
inlineprotected |
Remove a trait from the subject.
If there is no such trait in the subject, nothing is performed and EApparatusStatus::Noop is returned.
TraitType | The type of the trait to remove. |
|
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.
T | The type of the trait to remove. |
|
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.
TraitType | The type of the trait to remove. If nullptr , nothing is performed. |
|
inline |
Clear the subject handle, essentially making it invalid.
|
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.
Flag | The flag to set. |
bState | The state to set to. |
|
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.
Flag | The flag to set. |
bState | The state to set to. |
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.
Flagmark | The flagmark to set. The system-level bits are silently ignored. |
|
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.
Flagmark | The flagmark to set. The system-level bits are silently ignored. |
|
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.
Flagmark | The flagmark to set. |
Mask | The mask to use. |
|
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.
Flagmark | The flagmark to set. |
Mask | The mask to use. |
|
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
TraitRecord | The trait record to set to. |
|
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.
T | A type of the trait to add. |
Trait | A trait to initialize with. |
|
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
TraitType | The type of the trait to add. |
TraitData | The trait data to initialize with. |
|
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.
T | The type of the trait to add. |
Trait | The trait to initialize with. |
|
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.
TraitType | The type of the trait to add. |
TraitData | The trait data to initialize with. |
|
inlineprotected |
Set the server-side list of traits allowed to be received from clients.
Can only be set for a server-side subject.
|
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.
Flag | The flag to toggle. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
static |
The first valid generation.
|
static |
A first valid subject identifier.
|
protected |
A unique generation of the subject.
Used to validate the subject against reused slots.
|
static |
The maximum valid generation.
|
protected |
A unique identifier of the subject within the mechanism.
If this identifier is invalid, the handle is considered to be invalid.
|
static |
The maximum valid subject identifier.
|
static |
Invalid subject identifier.