Apparatus
Version 1.23
ECS data-oriented workflow for Unreal Engine.
|
The global state manager. More...
#include <Machine.h>
Public Types | |
enum | { InvalidChainId = FChain::InvalidId , FirstChainId = FChain::FirstId , InvalidSubjectIndex = FSubjectInfo::InvalidSlotIndex } |
typedef FSubjectInfo::IdType | SubjectIdType |
Public Member Functions | |
template<EParadigm Paradigm = EParadigm::Default> | |
TOutcome< Paradigm > | CopyTraitsFromTo (const FSubjectHandle &SrcSubjectHandle, const FSubjectHandle &DstSubjectHandle) |
Copy an existing subject traits to another one. | |
Static Public Member Functions | |
static int32 | ObtainTraitId (const UScriptStruct *TraitType) |
Obtain a trait's unique identifier. | |
static int32 | RegisteredTraitsNum () |
Get the total number of registered traits so far. | |
static const FBitMask & | ObtainTraitMask (const UScriptStruct *TraitType) |
Obtain the cached mask for a trait type. | |
template<typename T > | |
static const FBitMask & | ObtainTraitMask () |
Obtain the mask of a trait. | |
static int32 | ObtainDetailId (const TSubclassOf< UDetail > DetailClass) |
Obtain a detail's unique identifier. | |
static int32 | RegisteredDetailsNum () |
Get the total number of registered details so far. | |
static const FBitMask & | ObtainDetailMask (const TSubclassOf< UDetail > DetailClass) |
Obtain the cached mask of a detail type. | |
static const FBitMask & | ObtainExcludedDetailMask (const TSubclassOf< UDetail > DetailClass) |
Obtain the excluded mask of a detail class. | |
static const FBitMask & | ObtainDetailMask (const UDetail *Detail) |
Obtain the cached mask of a detail's class. | |
static const FBitMask & | ObtainExcludedDetailMask (const UDetail *Detail) |
Obtain the excluded mask of a details's class. | |
template<class T > | |
static const FBitMask & | ObtainDetailMask () |
Obtain the mask of a detail class. | |
template<class T > | |
static const FBitMask & | ObtainExcludedDetailMask () |
Obtain the excluding mask of a detail class. | |
static bool | HasInstance () |
Check if there is a global machine instance currently. | |
static UMachine * | ObtainInstance () |
Obtain the global machine instance. | |
static AMechanism * | ObtainMechanism (UPackage *const InPackage) |
Obtain a default mechanism instance for a package. | |
static AMechanism * | ObtainMechanism (UWorld *const InWorld) |
Obtain a mechanism instance for a world. | |
static int32 | MechanismsNum () |
Get the number of currently registered (active) mechanisms. | |
static int32 | CountSubjectsNum () |
Count the current number of effective subjects within all registered (active) mechanisms. | |
template<EParadigm Paradigm = EParadigm::Default> | |
static TOutcome< Paradigm > | DespawnSubjects (const EFlagmark Flagmark, const EFlagmark ExcludingFlagmark=FM_None) |
Despawn all the subjects matching a filter within all of the mechanisms. | |
template<EParadigm Paradigm = EParadigm::Default> | |
static TOutcome< Paradigm > | DespawnAllSubjects () |
Despawn all the available subjects within all of the mechanisms. | |
template<EParadigm Paradigm = EParadigm::Default> | |
static TOutcome< Paradigm > | Reset () |
Reset the machine completely, removing all of the subjects, unregistering all of the parts. | |
static EApparatusStatus | ReleaseInstance (const bool bReset=true) |
Release the machine from the root set, but only if it's no longer needed, i.e. | |
Static Public Attributes | |
static constexpr SubjectIdType | InvalidSubjectId = FSubjectInfo::InvalidId |
Invalid subject identifier. | |
static constexpr SubjectIdType | FirstSubjectPlace = FSubjectInfo::FirstPlace |
A first valid subject place. | |
static constexpr SubjectIdType | LastSubjectPlace = FSubjectInfo::LastPlace |
The last valid subject place. | |
Protected Member Functions | |
void | BeginDestroy () override |
Destroy the machine object. | |
UMachine () | |
The default constructor for the machine. | |
Friends | |
struct | FSubjectInfo |
struct | FSubjectNetworkState |
struct | FCommonSubjectHandle |
struct | FChunkSlot |
class | IIterable |
class | ISubjective |
class | IMechanical |
class | UBelt |
class | UChunk |
class | UNetworkBearerComponent |
class | AMechanism |
class | UApparatusFunctionLibrary |
template<typename SubjectHandleT > | |
struct | TChunkIt |
template<typename SubjectHandleT > | |
struct | TBeltIt |
template<typename ChunkItT , typename BeltItT , EParadigm Paradigm> | |
struct | TChain |
The global state manager.
This is the root Apparatus object. It is created automatically and persists until it's no longer needed.
anonymous enum |
|
inlineprotected |
The default constructor for the machine.
The constructor is made non-public, cause it shouldn't be called directly but only through new object creation procedure, which is called as a result of a machine's obtainment/retainment flow.
|
overrideprotected |
Destroy the machine object.
This should happen when the machine is no longer needed.
TOutcome< Paradigm > UMachine::CopyTraitsFromTo | ( | const FSubjectHandle & | SrcSubjectHandle, |
const FSubjectHandle & | DstSubjectHandle | ||
) |
Copy an existing subject traits to another one.
The existing traits of the destination subject are not removed but the new ones are added and override the existing matching. Supports copying traits among subjects of different mechanisms.
Paradigm | The paradigm to work under. |
SrcSubjectHandle | The source subject handle to copy from. |
DstSubjectHandle | The destination subject handle to copy to. |
|
inlinestatic |
Count the current number of effective subjects within all registered (active) mechanisms.
The method is generally not optimized and should be used occasionally.
|
inlinestatic |
Despawn all the available subjects within all of the mechanisms.
Paradigm | The paradigm to work under. |
|
inlinestatic |
Despawn all the subjects matching a filter within all of the mechanisms.
Paradigm | The paradigm to work under. |
Flagmark | The including flagmark to match. |
ExcludingFlagmark | The excluding flagmark to match. |
|
inlinestatic |
Check if there is a global machine instance currently.
|
inlinestatic |
Get the number of currently registered (active) mechanisms.
|
inlinestatic |
Obtain a detail's unique identifier.
Obtain the mask of a detail class.
Templated version.
|
inlinestatic |
Obtain the cached mask of a detail type.
Obtain the cached mask of a detail's class.
Obtain the excluding mask of a detail class.
Templated version.
|
inlinestatic |
Obtain the excluded mask of a detail class.
Obtain the excluded mask of a details's class.
|
inlinestatic |
Obtain the global machine instance.
The returned instance doesn't actually gets retained and will be a subject to garbage collection, unless explicitly retained.
This may only be called during the game running as the machine should not be part of the normal editing context.
|
inlinestatic |
Obtain a default mechanism instance for a package.
InPackage | The package to get a mechanism for. |
|
inlinestatic |
Obtain a mechanism instance for a world.
InWorld | A world to obtain a mechanism for. |
|
inlinestatic |
Obtain a trait's unique identifier.
Obtain the mask of a trait.
Templated version.
|
inlinestatic |
Obtain the cached mask for a trait type.
|
inlinestatic |
Get the total number of registered details so far.
|
inlinestatic |
Get the total number of registered traits so far.
|
inlinestatic |
Release the machine from the root set, but only if it's no longer needed, i.e.
has no entities registered.
You can call this method explicitly after the UMachine::Reset().
bReset | Should the machine be reset before releasing? Guarantees the machine to be released. |
|
static |
Reset the machine completely, removing all of the subjects, unregistering all of the parts.
This will also clear up the network id assignment state for the subjects completely.
Paradigm | The paradigm to work under. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |
A first valid subject place.
|
staticconstexpr |
Invalid subject identifier.
|
staticconstexpr |
The last valid subject place.