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

An interface for all sorts of sequences. More...

#include <Iterable.h>

Inheritance diagram for IIterable:
Inheritance graph
[legend]

Public Types

enum  { InvalidSlotIndex = -1 }
 

Public Member Functions

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...
 
virtual bool Matches (const FFilter &InFilter) const
 Check whether the sequence matches a filter. More...
 
Locking & Unlocking
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...
 

Protected Member Functions

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...
 
virtual EApparatusStatus DoUnlock (const bool bWasSolid) const
 Unlock the iterable, applying the pending changes. More...
 

Protected Attributes

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...
 

Friends

template<typename SubjectHandleT >
struct TChunkIt
 
template<typename ChunkItT , typename BeltItT , EParadigm Paradigm>
struct TChain
 

Detailed Description

An interface for all sorts of sequences.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidSlotIndex 

Invalid iterable slot index.

Member Function Documentation

◆ DequeueFromRemoved() [1/2]

int32 IIterable::DequeueFromRemoved ( ) const
inlineprotected

Dequeue a slot from being removed.

◆ DequeueFromRemoved() [2/2]

bool IIterable::DequeueFromRemoved ( int32 &  OutSlotIndex) const
inlineprotected

Dequeue a slot from being removed.

Reference version.

Parameters
OutSlotIndexThe index of the slot to queue for the removal.
Returns
Was the dequeueing operation successful or the queue is empty.

◆ DoLock()

virtual EApparatusStatus IIterable::DoLock ( ) const
inlineprotectedvirtual

Lock the iterable, preparing it for the iterating process.

May be implemented in the descendants.

Returns
The status of the operation.

◆ DoUnlock()

virtual EApparatusStatus IIterable::DoUnlock ( const bool  bWasSolid) const
inlineprotectedvirtual

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 in UBelt, and UChunk.

◆ EnqueueForRemoval()

void IIterable::EnqueueForRemoval ( const int32  SlotIndex) const
inlineprotected

Enqueue a slot for removal.

Parameters
SlotIndexThe index of the slot to queue for the removal.

◆ GetOwner()

AMechanism * IIterable::GetOwner ( ) const
inline

Get the owning mechanism of the iterable.

◆ HasQueuedForRemoval()

bool IIterable::HasQueuedForRemoval ( ) const
inline

Check if there are any slots marked for removal within the iterable.

The actual removal is delayed until the iterable becomes fully unlocked (stops being iterated).

◆ IsLiquidLocked()

bool IIterable::IsLiquidLocked ( ) const
inline

Check if the iterable is currently locked in a liquid manner.

Returns
The state of examination.

◆ IsLocked()

bool IIterable::IsLocked ( ) const
inline

Check if the sequence is currently locked.

The sequence is locked if its locks count is more than a zero.

Returns
The lock state.

◆ IsSolid()

bool IIterable::IsSolid ( ) const
inline

Check if the iterable is currently solid.

Being solid means being protected from any structural changes.

The iterable is solid if it's residing within a currently solid mechanism.

Returns
The state of examination.

◆ IsSolidLocked()

bool IIterable::IsSolidLocked ( ) const
inline

Check if the iterable is currently locked in a solid manner.

Returns
The state of examination.

◆ IterableNum()

int32 IIterable::IterableNum ( ) const
inline

Get the current number of elements valid for iterating.

Note
This number includes the stale (to be skipped) slots also.

◆ Lock()

template<bool bInSolid = false>
EApparatusStatus IIterable::Lock ( ) const

Lock the iterable, preparing it for the iterating process.

Template Parameters
bInSolidShould the iterable be locked in a solid manner.
Returns
The status of the operation.

◆ Matches()

virtual bool IIterable::Matches ( const FFilter InFilter) const
inlinevirtual

Check whether the sequence matches a filter.

Parameters
InFilterA filter to match.
Returns
The state of matching.

Reimplemented in UBelt, and UChunk.

◆ Num()

int32 IIterable::Num ( ) const
inline

Get the total number of slots currently in the iterable.

Note
Returns the active iterable slots number when the iterable is locked, which also includes the stale (to be skipped) slots.
Returns
The current number of slots.

◆ Unlock()

template<bool bInSolid>
EApparatusStatus IIterable::Unlock ( ) const

Unlock the iterable, applying the pending changes.

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

Friends And Related Function Documentation

◆ TChain

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

◆ TChunkIt

template<typename SubjectHandleT >
friend struct TChunkIt
friend

Member Data Documentation

◆ Count

int32 IIterable::Count = 0
protected

The logical (un-buffered) number of slots in the belt that are actually candidates for being iterated once the iterable is locked.

◆ IterableCount

std::atomic<int32> IIterable::IterableCount {-1}
mutableprotected

A number of currently iterable slots, excluding those, that were added before the unlocking.

This value is available and is valid only during iterating. Otherwise, it should be -1.

◆ LockingLock

std::atomic_flag IIterable::LockingLock = ATOMIC_FLAG_INIT
mutableprotected

The flag for implementing the locking functionality in a busy-waiting fashion.


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