Apparatus Version 1.22
ECS data-oriented workflow for Unreal Engine.
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
UBelt Class Reference

The conveyor belt consisting of subjects. More...

#include <Belt.h>

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

Public Types

enum  { InvalidSlotIndex = FBeltSlot::InvalidIndex , InvalidDetailLineIndex = FBeltSlot::InvalidDetailIndex }
 
- Public Types inherited from IIterable
enum  { InvalidSlotIndex = -1 }
 

Public Member Functions

constexpr bool IsSparse () const
 Is this a sparse belt allowing some empty detail spaces? More...
 
const FDetailmarkGetDetailmark () const
 The current decomposed detailmark of the belt. More...
 
int32 DetailLineIndexOf (const TSubclassOf< UDetail > DetailClass) const
 Get the line index for a detail class. More...
 
template<class D >
constexpr int32 DetailLineIndexOf () const
 Get the line index for a detail class. More...
 
AMechanismGetOwner () const
 Get the owning mechanism of the belt. More...
 
EApparatusStatus Expand (const FDetailmark &InDetailmark)
 Expand a belt to accommodate the new detailmark. More...
 
const FBeltSlotSlotAt (const int32 SlotIndex) const
 Get a belt slot by its index. More...
 
FBeltSlotSlotAt (const int32 SlotIndex)
 Get a belt slot by its index. More...
 
const FBeltSlotoperator[] (const int32 SlotIndex) const
 Get a belt slot by its index. More...
 
FBeltSlotoperator[] (const int32 SlotIndex)
 Get a belt slot by its index. More...
 
template<typename BeltItT >
BeltItT Begin (const FFilter &Filter, const int32 Offset=0)
 Begin iterating the belt under a certain filter. More...
 
template<typename BeltItT >
BeltItT End () const
 Get the ending iterator. More...
 
EApparatusStatus Refresh (ISubjective *const Subjective)
 Refresh a subjective within the belt. More...
 
bool Matches (const FFilter &Filter) const override
 Check if the belt matches a filter. More...
 
- Public Member Functions inherited from IIterable
AMechanismGetOwner () const
 Get the owning mechanism of the iterable. More...
 
bool IsLocked () const
 Check if the sequence is currently locked. More...
 
bool IsLiquidLocked () const
 Check if the iterable is currently locked in a liquid manner. More...
 
bool IsSolidLocked () const
 Check if the iterable is currently locked in a solid manner. More...
 
bool IsSolid () const
 Check if the iterable is currently solid. More...
 
bool HasQueuedForRemoval () const
 Check if there are any slots marked for removal within the iterable. More...
 
int32 Num () const
 Get the total number of slots currently in the iterable. More...
 
int32 IterableNum () const
 Get the current number of elements valid for iterating. More...
 
template<bool bInSolid = false>
EApparatusStatus Lock () const
 Lock the iterable, preparing it for the iterating process. More...
 
template<bool bInSolid>
EApparatusStatus Unlock () const
 Unlock the iterable, applying the pending changes. More...
 

Static Public Member Functions

static UBeltNew (UObject *const Owner, const FDetailmark &InDetailmark)
 Create a new belt instance. More...
 
static UBeltNew (UObject *const Owner, const FName &Name, const FDetailmark &InDetailmark)
 Create a new belt instance with a specific name. More...
 

Protected Member Functions

EApparatusStatus DoUnlock (const bool bWasSolid) const override
 Unlock the iterable, applying the pending changes. More...
 
- Protected Member Functions inherited from IIterable
void EnqueueForRemoval (const int32 SlotIndex) const
 Enqueue a slot for removal. More...
 
bool DequeueFromRemoved (int32 &OutSlotIndex) const
 Dequeue a slot from being removed. More...
 
int32 DequeueFromRemoved () const
 Dequeue a slot from being removed. More...
 
virtual EApparatusStatus DoLock () const
 Lock the iterable, preparing it for the iterating process. More...
 

Friends

struct FBeltSlot
 
template<typename SubjectHandleT >
struct TBeltIt
 
class USubjectiveActorComponent
 
class USubjectiveUserWidget
 
class UDetail
 
class AMechanism
 
class UMachine
 
class ISubjective
 

Additional Inherited Members

- Protected Attributes inherited from IIterable
int32 Count = 0
 The logical (un-buffered) number of slots in the belt that are actually candidates for being iterated once the iterable is locked. More...
 
std::atomic< int32 > IterableCount {-1}
 A number of currently iterable slots, excluding those, that were added before the unlocking. More...
 
std::atomic_flag LockingLock = ATOMIC_FLAG_INIT
 The flag for implementing the locking functionality in a busy-waiting fashion. More...
 

Detailed Description

The conveyor belt consisting of subjects.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidSlotIndex 

Invalid slot index.

InvalidDetailLineIndex 

Invalid detail line index.

Member Function Documentation

◆ Begin()

template<typename BeltItT >
BeltItT UBelt::Begin ( const FFilter Filter,
const int32  Offset = 0 
)
inline

Begin iterating the belt under a certain filter.

Template Parameters
BeltItTThe type of the belt iterator to use.
Parameters
FilterThe filter to iterate under.
OffsetThe offset for the slot to begin with.
Returns
The iterator to use for the iterating. Will point to the end, if the were no suiting slots currently available.

◆ DetailLineIndexOf() [1/2]

template<class D >
constexpr int32 UBelt::DetailLineIndexOf ( ) const
inlineconstexpr

Get the line index for a detail class.

Note
The method actually supports non-detail classes, i.e. INDEX_NONE will be safely returned in that case.
Template Parameters
DThe detail class to query for.
Returns
The hinting detail index.

◆ DetailLineIndexOf() [2/2]

int32 UBelt::DetailLineIndexOf ( const TSubclassOf< UDetail DetailClass) const
inline

Get the line index for a detail class.

Parameters
DetailClassThe detail class to query for.
Returns
The hinting detail index.

◆ DoUnlock()

EApparatusStatus UBelt::DoUnlock ( const bool  bWasSolid) const
inlineoverrideprotectedvirtual

Unlock the iterable, applying the pending changes.

Must be implemented in the descendants.

Parameters
bWasSolidShould the iterable be unlocked from a solid state.
Returns
The status of the operation.

Reimplemented from IIterable.

◆ End()

template<typename BeltItT >
BeltItT UBelt::End ( ) const
inline

Get the ending iterator.

Template Parameters
BeltItTThe type of the belt iterator.
Returns
The ending iterator.

◆ Expand()

EApparatusStatus UBelt::Expand ( const FDetailmark InDetailmark)

Expand a belt to accommodate the new detailmark.

Note
The target detailmark will be added while being decomposed to its base classes.
Parameters
InDetailmarkThe new detailmark to include.
Returns
The status of the operation. Returns EApparatusStatus::Noop if nothing was actually changed.

◆ GetDetailmark()

const FDetailmark & UBelt::GetDetailmark ( ) const
inline

The current decomposed detailmark of the belt.

Note
All of the base class details are decomposed into separate details here.
This is a detailmark for a sparse storage and some details may actually be missing within the physical belt slots.
This detailmark can change due to further belt expansions.
Returns
The current detailmark of the belt.

◆ GetOwner()

AMechanism * UBelt::GetOwner ( ) const
inline

Get the owning mechanism of the belt.

◆ IsSparse()

constexpr bool UBelt::IsSparse ( ) const
inlineconstexpr

Is this a sparse belt allowing some empty detail spaces?

◆ Matches()

bool UBelt::Matches ( const FFilter Filter) const
inlineoverridevirtual

Check if the belt matches a filter.

Reimplemented from IIterable.

◆ New() [1/2]

static UBelt * UBelt::New ( UObject *const  Owner,
const FDetailmark InDetailmark 
)
inlinestatic

Create a new belt instance.

◆ New() [2/2]

static UBelt * UBelt::New ( UObject *const  Owner,
const FName &  Name,
const FDetailmark InDetailmark 
)
inlinestatic

Create a new belt instance with a specific name.

◆ operator[]() [1/2]

FBeltSlot & UBelt::operator[] ( const int32  SlotIndex)
inline

Get a belt slot by its index.

Parameters
SlotIndexThe index of the belt slot.
Returns
The belt slot.

◆ operator[]() [2/2]

const FBeltSlot & UBelt::operator[] ( const int32  SlotIndex) const
inline

Get a belt slot by its index.

Constant version.

Parameters
SlotIndexThe index of the belt slot.
Returns
The belt slot.

◆ Refresh()

EApparatusStatus UBelt::Refresh ( ISubjective *const  Subjective)
inline

Refresh a subjective within the belt.

Parameters
SubjectiveA subjective to refresh.

◆ SlotAt() [1/2]

FBeltSlot & UBelt::SlotAt ( const int32  SlotIndex)
inline

Get a belt slot by its index.

Parameters
SlotIndexThe index of the belt slot.
Returns
The belt slot.

◆ SlotAt() [2/2]

const FBeltSlot & UBelt::SlotAt ( const int32  SlotIndex) const
inline

Get a belt slot by its index.

Constant version.

Parameters
SlotIndexThe index of the belt slot.
Returns
The belt slot.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ FBeltSlot

friend struct FBeltSlot
friend

◆ ISubjective

friend class ISubjective
friend

◆ TBeltIt

template<typename SubjectHandleT >
friend struct TBeltIt
friend

◆ UDetail

friend class UDetail
friend

◆ UMachine

friend class UMachine
friend

◆ USubjectiveActorComponent

friend class USubjectiveActorComponent
friend

◆ USubjectiveUserWidget

friend class USubjectiveUserWidget
friend

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