Apparatus Version 1.23
ECS data-oriented workflow for Unreal Engine.
Loading...
Searching...
No Matches
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.
 
bool IsLocked () const
 Check if the sequence is currently locked.
 
bool IsLiquidLocked () const
 Check if the iterable is currently locked in a liquid manner.
 
bool IsSolidLocked () const
 Check if the iterable is currently locked in a solid manner.
 
bool IsSolid () const
 Check if the iterable is currently solid.
 
bool HasQueuedForRemoval () const
 Check if there are any slots marked for removal within the iterable.
 
int32 Num () const
 Get the total number of slots currently in the iterable.
 
int32 IterableNum () const
 Get the current number of elements valid for iterating.
 
virtual bool Matches (const FFilter &InFilter) const
 Check whether the sequence matches a filter.
 
Locking & Unlocking
template<bool bInSolid>
EApparatusStatus Lock () const
 Lock the iterable, preparing it for the iterating process.
 
EApparatusStatus LockLiquid () const
 Lock the iterable in a liquid manner.
 
EApparatusStatus LockSolid () const
 Lock the iterable in a solid manner.
 
template<bool bInSolid>
EApparatusStatus Unlock () const
 Unlock the iterable, applying the pending changes.
 

Protected Member Functions

void EnqueueForRemoval (const int32 SlotIndex) const
 Enqueue a slot for removal.
 
bool DequeueFromRemoved (int32 &OutSlotIndex) const
 Dequeue a slot from being removed.
 
int32 DequeueFromRemoved () const
 Dequeue a slot from being removed.
 
virtual EApparatusStatus DoUnlock (const bool bWasSolid) const
 Unlock the iterable, applying the pending changes.
 

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.
 
std::atomic< int32 > IterableCount {-1}
 A number of currently iterable slots, excluding those, that were added before the unlocking.
 

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.

◆ DoUnlock()

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

Unlock the iterable, applying the pending changes.

Must be implemented in the descendants.

The procedure is guaranteed to be executed under a locked critical section for this chunk.

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

Returns
The current locking 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>
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.

◆ LockLiquid()

EApparatusStatus IIterable::LockLiquid ( ) const
inline

Lock the iterable in a liquid manner.

◆ LockSolid()

EApparatusStatus IIterable::LockSolid ( ) const
inline

Lock the iterable in a solid manner.

◆ 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 the locked iterating. Otherwise, it should be -1.


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