Apparatus Version 1.8
ECS data-oriented workflow for Unreal Engine.
Public Types | Public Member Functions | Friends | List of all members
TChunkIt< SubjectHandleT > Struct Template Reference

A generic chunk's iterator base. More...

#include <ChunkIt.h>

Public Types

enum  { IsSolid = SubjectHandleType::IsSolid , InvalidSubjectIndex = FSubjectInfo::InvalidIndex }
 
typedef SubjectHandleT SubjectHandleType
 The type of the subject handle used. More...
 
typedef SubjectHandleType::SubjectiveType SubjectiveType
 The compatible type of the subjective used. More...
 

Public Member Functions

int32 GetSlotIndex () const
 Get the current chunk's slot index. More...
 
template<bool S = IsSolid>
std::enable_if< S, void * >::type GetTraitPtr (UScriptStruct *const TraitType) const
 Get a trait of a certain type from a currently iterated subject. More...
 
template<typename T , bool S = IsSolid>
std::enable_if< S, T * >::type GetTraitPtr () const
 Get a pointer to a trait of a certain type from a currently iterated subject. More...
 
template<typename T , bool S = IsSolid>
std::enable_if< S, T & >::type GetTraitRef () const
 Get a trait reference of a certain type from a currently iterated subject. More...
 
template<bool S = IsSolid>
std::enable_if< S, void * >::type GetTraitPtrHinted (UScriptStruct *const TraitType, const int32 TraitIndexHint) const
 Get a trait pointer at a hinted index from a currently iterated subject. More...
 
template<typename T , bool S = IsSolid>
std::enable_if< S, T * >::type GetTraitPtrHinted (const int32 TraitIndexHint) const
 Get a trait pointer at a hinted index from a currently iterated subject. More...
 
template<typename T , bool S = IsSolid>
std::enable_if< S, T & >::type GetTraitRefHinted (const int32 TraitIndex) const
 Get a trait reference at a hinted index from a currently iterated subject. More...
 
UObject * GetSubjectiveObject () const
 Get the currently iterated subjective object (if available). More...
 
SubjectiveTypeGetSubjective () const
 Get a subjective from the chunk iterator (if any). More...
 
UChunkGetChunk () const
 Get the chunk of the iterator. More...
 
UChunkGetIterationChunk () const
 Get the real working chunk of the current iteration. More...
 
EApparatusStatus GetSubject (SubjectHandleT &OutSubject) const
 Get the subject from the chunk iterator. More...
 
SubjectHandleT GetSubject () const
 Get a subject from the chunk iterator. More...
 
const FFingerprintGetFingerprint () const
 Get the subject fingerprint from the chunk iterator. More...
 
EApparatusStatus GetTraitHinted (UScriptStruct *const TraitType, const int32 TraitIndex, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Get a trait at index from a currently iterated subject. More...
 
template<typename T >
GetTraitHinted (const int32 TraitIndexHint) const
 Get a copy of a trait at a hinted index from a currently iterated subject. More...
 
EApparatusStatus GetTrait (UScriptStruct *const TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Get a trait of a certain type from a currently iterated subject. More...
 
template<typename T >
GetTrait () const
 Get a copy of a trait of a certain type from a currently iterated subject. More...
 
UDetailGetDetail (const TSubclassOf< UDetail > DetailClass) const
 Get a detail of a certain class from a currently iterated subject. More...
 
template<class T >
T * GetDetail () const
 Get a detail of a certain class from a currently iterated subject. More...
 
void MoveToEnd ()
 Move the iterator to the end of the chunk. More...
 
void Reset ()
 Clear the iterator to a null-state. More...
 
bool IsViable () const
 Check if the iterator is valid and is not at the end of the chunk. More...
 
bool HasLocked () const
 Check whether the iterator has locked its chunk. More...
 
 operator bool () const
 Check if the iterator is valid and is not at the end of the chunk. More...
 
TChunkIt< SubjectHandleT > & operator= (const TChunkIt< SubjectHandleT > &Iterator)
 Set iterator equal to another iterator. More...
 
EApparatusStatus Advance ()
 Move iterator to the next place (if available). More...
 
 TChunkIt ()
 Initialize the chunk iterator. More...
 
 TChunkIt (const TChunkIt< SubjectHandleT > &Iterator)
 Initialize the chunk iterator as a copy of another iterator. More...
 
 ~TChunkIt ()
 Destroy the chunk iterator. More...
 

Friends

class UChunk
 
template<typename ChunkItT , typename BeltItT >
struct TChain
 

Detailed Description

template<typename SubjectHandleT>
struct TChunkIt< SubjectHandleT >

A generic chunk's iterator base.

Template Parameters
StructHandleTThe type of the subject handle.

Member Typedef Documentation

◆ SubjectHandleType

template<typename SubjectHandleT >
typedef SubjectHandleT TChunkIt< SubjectHandleT >::SubjectHandleType

The type of the subject handle used.

◆ SubjectiveType

template<typename SubjectHandleT >
typedef SubjectHandleType::SubjectiveType TChunkIt< SubjectHandleT >::SubjectiveType

The compatible type of the subjective used.

Member Enumeration Documentation

◆ anonymous enum

template<typename SubjectHandleT >
anonymous enum
Enumerator
IsSolid 

The uniformity of the chunk iterator.

InvalidSubjectIndex 

Invalid subject index.

Constructor & Destructor Documentation

◆ TChunkIt() [1/2]

template<typename SubjectHandleT >
TChunkIt< SubjectHandleT >::TChunkIt ( )
inline

Initialize the chunk iterator.

◆ TChunkIt() [2/2]

template<typename SubjectHandleT >
TChunkIt< SubjectHandleT >::TChunkIt ( const TChunkIt< SubjectHandleT > &  Iterator)
inline

Initialize the chunk iterator as a copy of another iterator.

Note
Locks the chunk appropriately, if it's available in the original.

◆ ~TChunkIt()

template<typename SubjectHandleT >
TChunkIt< SubjectHandleT >::~TChunkIt ( )
inline

Destroy the chunk iterator.

Note
Unlocks the chunk, if it has been locked.

Member Function Documentation

◆ Advance()

template<typename SubjectHandleT >
EApparatusStatus TChunkIt< SubjectHandleT >::Advance ( )
inline

Move iterator to the next place (if available).

Returns
The status of the operation.

◆ GetChunk()

template<typename SubjectHandleT >
UChunk* TChunkIt< SubjectHandleT >::GetChunk ( ) const
inline

Get the chunk of the iterator.

When an iterator comes to an end of a chunk it still persists this state value, unless cleared with Reset().

Returns
The chunk of the iterator (if any).

◆ GetDetail() [1/2]

template<typename SubjectHandleT >
template<class T >
T* TChunkIt< SubjectHandleT >::GetDetail ( ) const
inline

Get a detail of a certain class from a currently iterated subject.

Template Parameters
TThe class of the detail to get.

◆ GetDetail() [2/2]

template<typename SubjectHandleT >
UDetail* TChunkIt< SubjectHandleT >::GetDetail ( const TSubclassOf< UDetail DetailClass) const
inline

Get a detail of a certain class from a currently iterated subject.

Parameters
DetailClassThe class of the detail to get.

◆ GetFingerprint()

template<typename SubjectHandleT >
const FFingerprint& TChunkIt< SubjectHandleT >::GetFingerprint ( ) const
inline

Get the subject fingerprint from the chunk iterator.

Gets the fingerprint of the subject that is currently pointed by the chunk iterator.

Returns
The fingerprint of the current subject.

◆ GetIterationChunk()

template<typename SubjectHandleT >
UChunk* TChunkIt< SubjectHandleT >::GetIterationChunk ( ) const
inline

Get the real working chunk of the current iteration.

If the current subject is removed from the iterated chunk, its actual present chunk is returned.

◆ GetSlotIndex()

template<typename SubjectHandleT >
int32 TChunkIt< SubjectHandleT >::GetSlotIndex ( ) const
inline

Get the current chunk's slot index.

Returns
The current iterated slot index.

◆ GetSubject() [1/2]

template<typename SubjectHandleT >
SubjectHandleT TChunkIt< SubjectHandleT >::GetSubject ( ) const
inline

Get a subject from the chunk iterator.

Get a subject that is currently pointed by the chunk iterator.

Returns
The subject handle of the current iteration.

◆ GetSubject() [2/2]

template<typename SubjectHandleT >
EApparatusStatus TChunkIt< SubjectHandleT >::GetSubject ( SubjectHandleT &  OutSubject) const
inline

Get the subject from the chunk iterator.

Get the active subject that is currently pointed by the chunk iterator.

Parameters
OutSubjectThe subject handle receiver.
Returns
The status of the operation.

◆ GetSubjective()

template<typename SubjectHandleT >
SubjectiveType* TChunkIt< SubjectHandleT >::GetSubjective ( ) const
inline

Get a subjective from the chunk iterator (if any).

Get a subjective that is currently pointed by the chunk iterator if there is any associated with a subject.

Returns
The subjective of the current iteration. Returns nullptr, if there is none.

◆ GetSubjectiveObject()

template<typename SubjectHandleT >
UObject* TChunkIt< SubjectHandleT >::GetSubjectiveObject ( ) const
inline

Get the currently iterated subjective object (if available).

◆ GetTrait() [1/2]

template<typename SubjectHandleT >
template<typename T >
T TChunkIt< SubjectHandleT >::GetTrait ( ) const
inline

Get a copy of a trait of a certain type from a currently iterated subject.

Template Parameters
TThe type of the trait to get.
Returns
A copy of the trait.

◆ GetTrait() [2/2]

template<typename SubjectHandleT >
EApparatusStatus TChunkIt< SubjectHandleT >::GetTrait ( UScriptStruct *const  TraitType,
void *const  OutTraitData,
const bool  bTraitDataInitialized = true 
) const
inline

Get a trait of a certain type from a currently iterated subject.

Parameters
TraitTypeThe type of the trait to get.
OutTraitDataThe trait data receiver.
bTraitDataInitializedIs the OutTraitData buffer actually initialized?
Returns
The status of the operation.

◆ GetTraitHinted() [1/2]

template<typename SubjectHandleT >
template<typename T >
T TChunkIt< SubjectHandleT >::GetTraitHinted ( const int32  TraitIndexHint) const
inline

Get a copy of a trait at a hinted index from a currently iterated subject.

Gets a trait from a currently iterated subject with its hinted index, relative to the current chunk-locking filter's traitmark.

Template Parameters
TThe type of trait to get.
Parameters
TraitIndexHintThe index of the trait to hint with.
Returns
A copy of the requested trait.

◆ GetTraitHinted() [2/2]

template<typename SubjectHandleT >
EApparatusStatus TChunkIt< SubjectHandleT >::GetTraitHinted ( UScriptStruct *const  TraitType,
const int32  TraitIndex,
void *const  OutTraitData,
const bool  bTraitDataInitialized = true 
) const
inline

Get a trait at index from a currently iterated subject.

Gets a trait from a currently iterated subject by its index, relative to the current chunk-locking filter's traitmark.

Parameters
TraitTypeThe type of the trait to get.
TraitIndexThe index of the trait to get.
OutTraitDataThe trait data receiver.
bTraitDataInitializedIs the OutTraitData buffer actually initialized?
Returns
The status of the operation.

◆ GetTraitPtr() [1/2]

template<typename SubjectHandleT >
template<typename T , bool S = IsSolid>
std::enable_if<S, T*>::type TChunkIt< SubjectHandleT >::GetTraitPtr ( ) const
inline

Get a pointer to a trait of a certain type from a currently iterated subject.

Templated version.

Template Parameters
TThe type of the trait to get.
Returns
A pointer to the trait.

◆ GetTraitPtr() [2/2]

template<typename SubjectHandleT >
template<bool S = IsSolid>
std::enable_if<S, void*>::type TChunkIt< SubjectHandleT >::GetTraitPtr ( UScriptStruct *const  TraitType) const
inline

Get a trait of a certain type from a currently iterated subject.

Parameters
TraitTypeThe type of the trait to get.
Returns
A pointer to the trait data.

◆ GetTraitPtrHinted() [1/2]

template<typename SubjectHandleT >
template<typename T , bool S = IsSolid>
std::enable_if<S, T*>::type TChunkIt< SubjectHandleT >::GetTraitPtrHinted ( const int32  TraitIndexHint) const
inline

Get a trait pointer at a hinted index from a currently iterated subject.

Templated version.

Gets a trait from a currently iterated subject by its index, relative to the current chunk-locking filter's traitmark.

Template Parameters
TThe type of the trait to get.
Parameters
TraitIndexHintThe index hinting of the trait to get.
Returns
A pointer to the trait data.

◆ GetTraitPtrHinted() [2/2]

template<typename SubjectHandleT >
template<bool S = IsSolid>
std::enable_if<S, void*>::type TChunkIt< SubjectHandleT >::GetTraitPtrHinted ( UScriptStruct *const  TraitType,
const int32  TraitIndexHint 
) const
inline

Get a trait pointer at a hinted index from a currently iterated subject.

Gets a trait from a currently iterated subject by its index, relative to the current chunk-locking filter's traitmark.

Parameters
TraitTypeThe type of the trait to get.
TraitIndexHintThe index hinting of the trait to get.
Returns
A pointer to the trait data.

◆ GetTraitRef()

template<typename SubjectHandleT >
template<typename T , bool S = IsSolid>
std::enable_if<S, T&>::type TChunkIt< SubjectHandleT >::GetTraitRef ( ) const
inline

Get a trait reference of a certain type from a currently iterated subject.

Template Parameters
TThe type of the trait to get.
Returns
A reference for the trait.

◆ GetTraitRefHinted()

template<typename SubjectHandleT >
template<typename T , bool S = IsSolid>
std::enable_if<S, T&>::type TChunkIt< SubjectHandleT >::GetTraitRefHinted ( const int32  TraitIndex) const
inline

Get a trait reference at a hinted index from a currently iterated subject.

Gets a trait from a currently iterated subject by its index, relative to the current chunk-locking filter's traitmark.

Template Parameters
TThe type of trait to get.
Parameters
TraitIndexThe index of the trait to get.
Returns
A reference to the trait data.

◆ HasLocked()

template<typename SubjectHandleT >
bool TChunkIt< SubjectHandleT >::HasLocked ( ) const
inline

Check whether the iterator has locked its chunk.

◆ IsViable()

template<typename SubjectHandleT >
bool TChunkIt< SubjectHandleT >::IsViable ( ) const
inline

Check if the iterator is valid and is not at the end of the chunk.

Returns
The state of examination.

◆ MoveToEnd()

template<typename SubjectHandleT >
void TChunkIt< SubjectHandleT >::MoveToEnd ( )
inline

Move the iterator to the end of the chunk.

◆ operator bool()

template<typename SubjectHandleT >
TChunkIt< SubjectHandleT >::operator bool ( ) const
inline

Check if the iterator is valid and is not at the end of the chunk.

Returns
The state of examination.

◆ operator=()

template<typename SubjectHandleT >
TChunkIt<SubjectHandleT>& TChunkIt< SubjectHandleT >::operator= ( const TChunkIt< SubjectHandleT > &  Iterator)
inline

Set iterator equal to another iterator.

◆ Reset()

template<typename SubjectHandleT >
void TChunkIt< SubjectHandleT >::Reset ( )
inline

Clear the iterator to a null-state.

Friends And Related Function Documentation

◆ TChain

template<typename SubjectHandleT >
template<typename ChunkItT , typename BeltItT >
friend struct TChain
friend

◆ UChunk

template<typename SubjectHandleT >
friend class UChunk
friend

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