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

Common chain functionality. More...

#include <CommonChain.h>

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

Classes

struct  FCommonCursor
 Common chain cursor functionality. More...
 
struct  TSegment
 The common functionality for a single iterable entry within the chain. More...
 

Public Types

enum  {
  InvalidId = -1 , InvalidSlotIndex = -1 , FirstId = 0 , InvalidCursorId = -1 ,
  DefaultCursorId = 0 , InvalidSegmentIndex = -1
}
 

Public Member Functions

AMechanismGetOwner () const
 Get the owning mechanism of the chain. More...
 
const FFilterGetFilter () const
 Get the current filter used to enchain the iterables. More...
 
bool IsDisposed () const
 Check if the chain is disposed and is ready to be reused. More...
 
int32 UsersNum () const
 Get the current number of users of the chain. More...
 
void Retain () const
 Add a user of the chain preventing it from being disposed. More...
 
void Release () const
 Remove a user of the chain, possibly making it a subject for disposal. More...
 
EApparatusStatus Dispose ()
 Reset the state of the chain and mark as disposed (ready to be reused). More...
 
virtual EApparatusStatus Reset ()
 Reset the chain. More...
 
bool ShouldStopIterating () const
 Check if the chain should stop iterating. More...
 
EApparatusStatus StopIterating () const
 Stop the current iterating of the chain (if any). More...
 
virtual ~FCommonChain ()
 

Protected Member Functions

 FCommonChain (AMechanism *const InOwner)
 
void IncrementOperatingsCount () const
 
void DecrementOperatingsCount () const
 

Protected Attributes

AMechanismOwner = nullptr
 The owner of the chain. More...
 
int32 Id = InvalidId
 A unique identifier of the chain. More...
 
std::atomic< int32 > UsersCount {0}
 The number of users currently needing the chain. More...
 
bool bDisposed = true
 Was this chain disposed and ready to be reused? More...
 
std::atomic< bool > bStopIterating {false}
 Was this chain stopped from iterating? More...
 
FFilter Filter
 A filter under which the iterables are locked within the chain. More...
 

Friends

class UApparatusFunctionLibrary
 
class AMechanism
 
class UMachine
 

Detailed Description

Common chain functionality.

Contains the basic functionality universal for all of the chains.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidId 

Invalid chain identifier.

InvalidSlotIndex 

Invalid slot index.

FirstId 

First valid chain identifier.

InvalidCursorId 

Invalid cursor identifier.

DefaultCursorId 

Default cursor identifier.

InvalidSegmentIndex 

Invalid segment index.

Constructor & Destructor Documentation

◆ ~FCommonChain()

virtual FCommonChain::~FCommonChain ( )
inlinevirtual

◆ FCommonChain()

FCommonChain::FCommonChain ( AMechanism *const  InOwner)
inlineprotected

Member Function Documentation

◆ DecrementOperatingsCount()

void FCommonChain::DecrementOperatingsCount ( ) const
protected

◆ Dispose()

EApparatusStatus FCommonChain::Dispose ( )

Reset the state of the chain and mark as disposed (ready to be reused).

◆ GetFilter()

const FFilter & FCommonChain::GetFilter ( ) const
inline

Get the current filter used to enchain the iterables.

◆ GetOwner()

AMechanism * FCommonChain::GetOwner ( ) const
inline

Get the owning mechanism of the chain.

Returns
The mechanism of the chain.

◆ IncrementOperatingsCount()

void FCommonChain::IncrementOperatingsCount ( ) const
protected

◆ IsDisposed()

bool FCommonChain::IsDisposed ( ) const
inline

Check if the chain is disposed and is ready to be reused.

Returns
The status of examination.

◆ Release()

void FCommonChain::Release ( ) const
inline

Remove a user of the chain, possibly making it a subject for disposal.

◆ Reset()

virtual EApparatusStatus FCommonChain::Reset ( )
inlinevirtual

Reset the chain.

All of the chain segments (iterables) get released as part of this operation.

The embedded cursors will get reset as well, but you have to release all of the manual users beforehand.

Returns
The status of the operation.

Reimplemented in TChain< ChunkItT, BeltItT, InDefaultParadigm >.

◆ Retain()

void FCommonChain::Retain ( ) const
inline

Add a user of the chain preventing it from being disposed.

◆ ShouldStopIterating()

bool FCommonChain::ShouldStopIterating ( ) const
inline

Check if the chain should stop iterating.

◆ StopIterating()

EApparatusStatus FCommonChain::StopIterating ( ) const
inline

Stop the current iterating of the chain (if any).

◆ UsersNum()

int32 FCommonChain::UsersNum ( ) const
inline

Get the current number of users of the chain.

Note
Even an unused chain can be indisposed. This is by design and is needed to correctly initialize the chain.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ UApparatusFunctionLibrary

friend class UApparatusFunctionLibrary
friend

◆ UMachine

friend class UMachine
friend

Member Data Documentation

◆ bDisposed

bool FCommonChain::bDisposed = true
protected

Was this chain disposed and ready to be reused?

◆ bStopIterating

std::atomic<bool> FCommonChain::bStopIterating {false}
mutableprotected

Was this chain stopped from iterating?

◆ Filter

FFilter FCommonChain::Filter
protected

A filter under which the iterables are locked within the chain.

◆ Id

int32 FCommonChain::Id = InvalidId
protected

A unique identifier of the chain.

Should be valid only for mechanism-embedded chains.

◆ Owner

AMechanism* FCommonChain::Owner = nullptr
protected

The owner of the chain.

Must be set during the initialization.

◆ UsersCount

std::atomic<int32> FCommonChain::UsersCount {0}
mutableprotected

The number of users currently needing the chain.

If it becomes zero the chain is disposed.


The documentation for this struct was generated from the following file: