Apparatus
Version 1.23
ECS data-oriented workflow for Unreal Engine.
|
The base structure for all subject handles. More...
#include <CommonSubjectHandle.h>
Public Types | |
typedef FSubjectInfo::MechanismIdType | MechanismIdType |
The type of the unique mechanism identifier. | |
typedef FSubjectInfo::IdType | IdType |
The type of the unique subject identifier. | |
typedef FSubjectInfo::GenerationType | GenerationType |
The type of the subject generation counter. | |
using | NetworkIdType = FSubjectNetworkState::IdType |
The type of the network identifier. | |
Public Member Functions | |
FCommonSubjectHandle () | |
Initialize an invalid (null) handle. | |
FCommonSubjectHandle (const FCommonSubjectHandle &InSubjectHandle) | |
Initialize as a copy of an another subject handle. | |
A Pointer-Like Interface | |
auto | operator-> () const |
Use the handle as a pointer. | |
auto & | operator* () const |
Dereference itself. | |
Identification | |
IdType | GetId () const |
Get the unique identifier of the subject. | |
GenerationType | GetGeneration () const |
Get the current generation of the subject. | |
auto | GetMechanismId () const |
Get the identifier of the mechanism the subject is part of. | |
auto | GetPlace () const |
Get the place index of the subject. | |
Common Functionality | |
bool | IsSolid () const |
Check if the subject is currently solid. | |
void | ResetHandle () |
Reset the subject handle. | |
FCommonSubjectHandle & | operator= (TYPE_OF_NULLPTR) |
Clear the subject handle, essentially making it invalid. | |
uint32 | CalcHash () const |
Calculate the hash-sum value for the handle. | |
AMechanism * | GetMechanism () const |
Get the mechanism the subject is part of. | |
const FFingerprint & | GetFingerprint () const |
Get the current fingerprint of the subject. | |
bool | Matches (const FFilter &InFilter) const |
Check if the subject matches a certain filter. | |
Validity | |
bool | IsValid () const |
Check if the subject handle is valid and is pointing to an existent subject. | |
bool | operator== (TYPE_OF_NULLPTR) const |
Check if the subject handle is invalid and is pointing to a non-existent subject. | |
bool | operator!= (TYPE_OF_NULLPTR) const |
Check if the subject handle is valid and is pointing to an existent subject. | |
operator bool () const | |
Check if the subject handle is valid and is pointing to an existent subject. | |
Comparison | |
bool | EqualsRaw (const FCommonSubjectHandle &InSubject) const |
Check if two subject handles are equal byte-wise. | |
bool | Equals (const FCommonSubjectHandle &InSubjectHandle) const |
Check if the subject handle points to the same subject as the other one. | |
bool | operator== (const FCommonSubjectHandle &InSubjectHandle) const |
Check if the subject handle points to the same subject as the other one. | |
bool | operator!= (const FCommonSubjectHandle &InSubjectHandle) const |
Check if the subject handles point to different subjects. | |
Flagmark Examination | |
EFlagmark | GetFlagmark () const |
Get the flagmark of the subject. | |
bool | HasFlag (const EFlagmarkBit Flag) const |
Get the state of a certain flag of the subject. | |
Components Examination | |
bool | HasTrait (UScriptStruct *const TraitType) const |
Check if the subject has a certain trait. | |
template<typename T > | |
std::enable_if< IsTraitType< T >(), bool >::type | HasTrait () const |
Check if the subject has a certain trait. | |
bool | HasDetail (TSubclassOf< UDetail > DetailClass) const |
Check if the subject has a certain detail. | |
template<typename D > | |
std::enable_if< IsDetailClass< D >(), bool >::type | HasDetail () const |
Check if the subject has a certain detail. | |
Traits Getting | |
template<EParadigm Paradigm = EParadigm::Default> | |
TOutcome< Paradigm > | GetTrait (UScriptStruct *const TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const |
Get a trait from the subject by its type. | |
template<EParadigm Paradigm = EParadigm::Default, typename T = void> | |
TOutcome< Paradigm > | GetTrait (T &OutTrait, const bool bTraitDataInitialized=true) const |
Get a trait from a subject by its type. | |
template<EParadigm Paradigm, typename T > | |
TOutcome< Paradigm, T > | GetTrait () const |
Get a trait copy from the subject by its type. | |
template<typename T , EParadigm Paradigm = EParadigm::Default> | |
TOutcome< Paradigm, T > | GetTrait () const |
Get a trait copy from the subject by its type. | |
Common Networking | |
bool | IsOnline () const |
Check if the subject currently networked. | |
NetworkIdType | GetNetworkId () const |
Get a unique network identifier of a subject (if any). | |
bool | IsInNetworkMode (const ENetMode Mode) const |
Check if the subject is of a certain network mode. | |
bool | IsServerSide () const |
Check if this is a server-side version of the subject. | |
bool | IsClientSide () const |
Check if this is a client-side version of the subject. | |
UNetConnection * | GetConnectionPermit () const |
Get the server-side connection that is allowed to push to the server's version of the subject. | |
const FTraitmark & | GetTraitmarkPermit () const |
Get the server-side list of traits allowed to be received from clients. | |
const FTraitmark & | GetTraitmarkPass () const |
Assignment | |
FCommonSubjectHandle & | operator= (const FCommonSubjectHandle &InSubjectHandle) |
Assign to be a copy of an another subject handle. | |
Static Public Attributes | |
static constexpr IdType | InvalidId = FSubjectInfo::InvalidId |
Invalid subject identifier. | |
static constexpr IdType | FirstPlace = FSubjectInfo::FirstPlace |
A first valid subject identifier. | |
static constexpr IdType | LastPlace = FSubjectInfo::LastPlace |
The maximum valid subject identifier. | |
static constexpr GenerationType | FirstGeneration = FSubjectInfo::FirstGeneration |
The first valid generation. | |
static constexpr GenerationType | LastGeneration = FSubjectInfo::LastGeneration |
The maximum valid generation. | |
static const FCommonSubjectHandle | Invalid |
An invalid common subject handle constant. | |
Protected Member Functions | |
FSubjectInfo * | FindInfo () const |
Get the valid subject info record (if any). | |
FSubjectInfo & | GetInfo () const |
Get the subject info record associated with it. | |
FFingerprint & | GetFingerprintRef () const |
Get the current fingerprint's reference of the subject. | |
template<EParadigm Paradigm = EParadigm::DefaultInternal> | |
TOutcome< Paradigm, bool > | MarkBooted () const |
UChunk * | GetChunk () const |
Get the current chunk of the subject. | |
ISubjective * | GetSubjective () const |
Get a subjective this handle is associated with (if any). | |
UDetail * | GetDetail (TSubclassOf< UDetail > DetailClass) const |
Get a detail of a certain class. | |
template<class D > | |
D * | GetDetail () const |
Get a detail of a certain class. | |
FCommonSubjectHandle (const IdType InId, const GenerationType InGeneration) | |
Initialize a common handle with explicit id and generation specifications. | |
FCommonSubjectHandle (const MechanismIdType InMechanismId, const IdType InPlace, const GenerationType InGeneration) | |
Initialize a common handle with explicit mechanism, placement and generation specifications. | |
Protected Attributes | |
int32 | Id = InvalidId |
A unique identifier of the subject within the mechanism. | |
uint32 | Generation = FirstGeneration |
A unique generation of the subject. | |
Friends | |
template<typename ChunkItT , typename BeltItT , EParadigm Paradigm> | |
struct | TChain |
template<typename SubjectHandleT > | |
struct | TChunkIt |
template<typename SubjectHandleT > | |
struct | TBeltIt |
struct | FSubjectInfo |
struct | FSubjectNetworkState |
struct | FSubjectHandle |
struct | FSolidSubjectHandle |
struct | FConstSubjectHandle |
struct | FUnsafeSubjectHandle |
struct | FChunkSlot |
struct | FSubjectRecord |
class | UChunk |
class | AMechanism |
class | UMachine |
class | ISubjective |
class | UNetworkBearerComponent |
class | ASubjectiveActor |
class | USubjectiveActorComponent |
The base structure for all subject handles.
Shouldn't really be used by the end-user of the framework.
The size of the handle should be exactly 64-bits and can be passed to functions by value.
Subject handles are not meant to be serialized.
The type of the subject generation counter.
The type of the unique subject identifier.
The type of the unique mechanism identifier.
The type of the network identifier.
|
inlineprotected |
Initialize a common handle with explicit id and generation specifications.
InId | The unique subject identifier. |
InGeneration | The generation of the subject. |
|
inlineprotected |
Initialize a common handle with explicit mechanism, placement and generation specifications.
InMechanismId | The unique mechanism identifier. |
InPlace | The unique place of the subject within its mechanism. |
InGeneration | The generation of the subject. |
|
inline |
Initialize an invalid (null) handle.
|
inline |
Initialize as a copy of an another subject handle.
InSubjectHandle | The subject handle to copy. |
uint32 FCommonSubjectHandle::CalcHash | ( | ) | const |
Calculate the hash-sum value for the handle.
|
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 two subject handles are equal byte-wise.
|
protected |
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.
|
protected |
Get the current chunk of the subject.
nullptr
, if there is none. UNetConnection * FCommonSubjectHandle::GetConnectionPermit | ( | ) | const |
Get the server-side connection that is allowed to push to the server's version of the subject.
Can only be queried from a server-side subject.
Get a detail of a certain class.
Templated version.
The method is protected since the child classes have to provide the exact return value semantics.
D | The class of the detail to get. |
Get a detail of a certain class.
The method is protected since the child classes have to provide the exact return value semantics.
DetailClass | The class of the detail to get. |
const FFingerprint & FCommonSubjectHandle::GetFingerprint | ( | ) | const |
Get the current fingerprint of the subject.
|
protected |
Get the current fingerprint's reference of the subject.
|
inline |
Get the flagmark of the subject.
|
inline |
Get the current generation of the subject.
Each unique instance of a subject has a unique combination of its generation and identifier.
|
inline |
Get the unique identifier of the subject.
The identifier is unique along the lifetime of the subject. It gets reused (under a different generation) after the subject is despawned.
You can use the identifier for the purpose of ordering.
|
protected |
Get the subject info record associated with it.
AMechanism * FCommonSubjectHandle::GetMechanism | ( | ) | const |
Get the mechanism the subject is part of.
|
inline |
Get the identifier of the mechanism the subject is part of.
NetworkIdType FCommonSubjectHandle::GetNetworkId | ( | ) | const |
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.
|
inline |
Get the place index of the subject.
This is the index of the subject information structure within the mechanism's subject pool.
|
protected |
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.
The method is private, cause the exact subjective pointer type has to be cast to.
Get a trait copy from the subject by its type.
Compile-time paradigm version.
Paradigm | The paradigm to work under. |
T | The type of the trait to get. |
Get a trait copy from the subject by its type.
Compile-time version.
T | The type of the trait to get. |
Paradigm | The paradigm to work under. |
|
inline |
Get a trait from a subject by its type.
Compile-time outputting version.
T | The type of the trait to get. |
[out] | OutTrait | The trait receiver. |
[out] | bTraitDataInitialized | Is the OutTrait actually initialized? |
|
inline |
Get a trait from the subject by its type.
Dynamic outputting version.
Paradigm | The paradigm to work under. |
T | The type of the trait data to receive the trait. Must match the one specified within the TraitType or be void . |
[in] | TraitType | The type of the trait to get. Must match that of the T . |
[out] | OutTraitData | The trait data receiver. Must not be a nullptr if the TraitType is set. |
[in] | bTraitDataInitialized | Is the OutTraitData buffer actually initialized? |
|
inline |
const FTraitmark & FCommonSubjectHandle::GetTraitmarkPermit | ( | ) | const |
Get the server-side list of traits allowed to be received from clients.
Can only be queried from a server-side subject.
|
inline |
Check if the subject has a certain detail.
Templated version.
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.
bool FCommonSubjectHandle::IsClientSide | ( | ) | const |
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 is of a certain network mode.
The subject's world is used to determine the mode (if any), otherwise false
is returned, unless the mode is ENetMode::Standalone.
Mode | The network mode to check against. |
bool FCommonSubjectHandle::IsOnline | ( | ) | const |
Check if the subject currently networked.
Networked subject can receive and push traits over the network to the remote versions of themselves.
bool FCommonSubjectHandle::IsServerSide | ( | ) | const |
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 is currently solid.
The subject is solid if it's part of a solid mechanism.
Invalid subject handles will return false
here.
|
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 |
Check if the subject matches a certain filter.
|
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 |
Dereference itself.
This interface is needed for compatiblity
|
inline |
Use the handle as a pointer.
This interface is needed for compatiblity
|
inline |
Assign to be a copy of an another subject handle.
InSubjectHandle | The subject handle to copy. |
|
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.
|
inline |
Reset the subject handle.
Only the handle itself is reset. The referenced subject (if any) will remain intact.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |
The first valid generation.
|
staticconstexpr |
A first valid subject identifier.
|
protected |
A unique generation of the subject.
Used to validate the subject against reused slots.
|
protected |
A unique identifier of the subject within the mechanism.
If this identifier is invalid, the handle is considered to be invalid.
|
static |
An invalid common subject handle constant.
|
staticconstexpr |
Invalid subject identifier.
|
staticconstexpr |
The maximum valid generation.
|
staticconstexpr |
The maximum valid subject identifier.