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
UChunk Class Reference

The main containter for the subjects' traits. More...

#include <Chunk.h>

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

Public Types

enum  { InvalidId = 0 , FirstId = 1 , InvalidTraitLineIndex = -1 , InvalidSlotIndex = FSubjectInfo::InvalidSlotIndex }
 
- Public Types inherited from IIterable
enum  { InvalidSlotIndex = -1 }
 

Public Member Functions

const FTraitmarkGetTraitmark () const
 Get the traitmark of the chunk. More...
 
AMechanismGetOwner () const
 Get the owning mechanism of the chunk. More...
 
bool IsSlotLocked (const int32 SlotIndex) const
 Check if the subject at specified place is locked. More...
 
void Reserve (const int32 InCapacity)
 Reserve a certain capacity. More...
 
template<typename ChunkItT >
ChunkItT Begin (const FFilter &Filter, const int32 Offset=0)
 Begin iterating the chunk. More...
 
template<typename ChunkItT >
ChunkItT End () const
 The ending iterator. More...
 
EApparatusStatus SetTraitAt (const int32 SlotIndex, const UScriptStruct *const TraitType, const void *const InTraitData)
 Set the trait for the chunk's subject by its type identifier. More...
 
EApparatusStatus FetchTraitsPtrs (const int32 SlotIndex, const TArray< int32 > &Mapping, void **OutTraits)
 Fetch the traits for a subject into a traits data array. More...
 
EApparatusStatus OverwriteTraits (const int32 SrcSlotIndex, class UChunk *const DstChunk, const int32 DstSlotIndex) const
 Copy the traits from this chunk to another one, given subject indices. More...
 
EApparatusStatus OverwriteTraits (const int32 SrcSlotIndex, class UChunk *const DstChunk, const int32 DstSlotIndex)
 Copy the traits from this chunk to another one, given subject indices. More...
 
EApparatusStatus SwapTraits (const int32 SlotIndex, class UChunk *OtherChunk, const int32 OtherSlotIndex, const bool bClearMissing=true)
 Swap the traits from this chunk with another one, given subject indices. More...
 
EApparatusStatus OverwriteTraits (const int32 SrcSlotIndex, const int32 DstSlotIndex)
 Copy the traits within the chunk, given subject indices. More...
 
bool Matches (const FFilter &Filter) const override
 Check whether the chunk matches a filter. More...
 
bool Check () const
 Check the validity of the chunk. More...
 
template<>
const FScriptStructArrayFindTraitLine () const
 
template<>
FScriptStructArrayFindTraitLine ()
 
template<>
const FScriptStructArrayFindTraitLine () const
 
template<>
FScriptStructArrayFindTraitLine ()
 
Slots
const FChunkSlotAt (const int32 SlotIndex) const
 Get a slot at a certain position. More...
 
FChunkSlotAt (const int32 SlotIndex)
 Get a slot at a certain position. More...
 
const FChunkSlotoperator[] (const int32 SlotIndex) const
 Get a slot at a certain position. More...
 
FChunkSlotoperator[] (const int32 SlotIndex)
 Get a slot at a certain position. More...
 
bool IsStaleAt (const int32 SlotIndex) const
 Check if a slot is stale at a certain position. More...
 
Subjects
template<typename SubjectHandleT = FSubjectHandle>
SubjectHandleT SubjectAt (const int32 SlotIndex) const
 Get a subject at a specific slot index. More...
 
const FFingerprintSubjectFingerprintAt (const int32 SlotIndex) const
 Get a subject's fingerprint at a specific slot index. More...
 
EFlagmark SubjectFlagmarkAt (const int32 SlotIndex) const
 Get a subject's flagmark at a specific slot index. More...
 
bool HasSubjectFlagAt (const int32 SlotIndex, const EFlagmarkBit Flag) const
 Check a subject's flag at a specific slot index. More...
 
template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark SetSubjectFlagmarkAt (const int32 SlotIndex, const EFlagmark Flagmark) const
 Set a subject's flagmark at a specific slot index. More...
 
template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark SetSubjectFlagmarkMaskedAt (const int32 SlotIndex, const EFlagmark Flagmark, const EFlagmark Mask)
 Set the masked flagmark for the subject. More...
 
template<EParadigm Paradigm = EParadigm::Safe>
bool SetSubjectFlagAt (const int32 SlotIndex, const EFlagmarkBit Flag, const bool bState=true) const
 Set a subject's flag at a specific slot index. More...
 
template<EParadigm Paradigm = EParadigm::Safe>
bool ToggleSubjectFlagAt (const int32 SlotIndex, const EFlagmarkBit Flag) const
 Toggle a subject's flag at a specific slot index. More...
 
Trait Lines
UScriptStruct * TraitLineTypeAt (const int32 LineIndex) const
 Get the type of a trait line. More...
 
int32 TraitLinesNum () const
 The number of trait lines in the chunk. More...
 
int32 TraitLineTraitSizeAt (const int32 LineIndex) const
 Get the size of a trait given its line index. More...
 
const FScriptStructArrayGetTraitLine (UScriptStruct *const TraitType) const
 Get a trait line by the type of its element. More...
 
template<typename T >
const FScriptStructArrayGetTraitLine () const
 Get a trait line by the type of its element. More...
 
const FScriptStructArrayTraitLineAt (const int32 LineIndex) const
 Get a trait line at a specific index. More...
 
FScriptStructArrayTraitLineAt (const int32 LineIndex)
 Get a trait line at a specific index. More...
 
const FScriptStructArrayFindTraitLine (UScriptStruct *const TraitType) const
 Find a trait line by the type of its element. More...
 
FScriptStructArrayFindTraitLine (UScriptStruct *const TraitType)
 Find a trait line by the type of its element. More...
 
template<typename T >
const FScriptStructArrayFindTraitLine () const
 Find a trait line by the type of its element. More...
 
template<typename T >
FScriptStructArrayFindTraitLine ()
 Find a trait line by the type of its element. More...
 
int32 TraitLineIndexOf (UScriptStruct *const TraitType) const
 Get the trait line index of a trait. More...
 
template<typename T >
constexpr int32 TraitLineIndexOf () const
 Get the trait line index of a trait. More...
 
Traits Access
template<typename T >
T TraitAt (const int32 SlotIndex, const int32 LineIndex) const
 Get a copy of a trait given subject's index and a line index. More...
 
template<typename T >
T TraitAtHinted (const int32 SubjectIndex, int32 LineIndexHint) const
 Get a copy of a trait given subject's index and a line index hint. More...
 
EApparatusStatus TraitAt (const int32 SubjectIndex, const int32 LineIndex, void *const OutTraitData, bool bTraitDataInitialized=true) const
 Copy a trait's data given a subject and line indices to a supplied data buffer. More...
 
EApparatusStatus TraitAtHinted (const int32 SubjectIndex, UScriptStruct *const TraitType, int32 LineIndexHint, void *const OutTraitData, bool bTraitDataInitialized=true) const
 Copy a trait's data given a subject and line indices to a supplied data buffer. More...
 
EApparatusStatus TraitAt (const int32 SlotIndex, const UScriptStruct *const TraitType, void *const OutTraitData, const bool bTraitDataInitialized=true) const
 Copy a trait from the chunk's subject by its type identifier. More...
 
template<typename T >
T TraitAt (const int32 SlotIndex) const
 Get a copy of a trait from the chunk's subject by its type identifier. More...
 
Traits Data Access
void * TraitPtrAt (const int32 SlotIndex, const int32 LineIndex)
 Get the trait data pointer given subject's index and a line index. More...
 
const void * TraitPtrAt (const int32 SlotIndex, const int32 LineIndex) const
 Get the trait data pointer given subject's index and a line index. More...
 
template<typename T >
TTraitRefAt (const int32 SlotIndex, const int32 LineIndex)
 Get the trait reference given subject's index and a line index. More...
 
template<typename T >
TTraitRefAtHinted (const int32 SlotIndex, int32 LineIndexHint)
 Get the trait reference given subject's index and a line index hint. More...
 
template<typename T >
const TTraitRefAt (const int32 SlotIndex, const int32 LineIndex) const
 Get a trait reference given subject's index and a line index. More...
 
template<typename T >
const TTraitRefAtHinted (const int32 SlotIndex, int32 LineIndexHint) const
 Get the trait reference given subject's index and a line index hint. More...
 
const void * TraitPtrAt (const int32 SlotIndex, const UScriptStruct *const TraitType) const
 Get the read-only trait data pointer from the chunk's subject by its type identifier. More...
 
void * TraitPtrAt (const int32 SlotIndex, UScriptStruct *const TraitType)
 Get the trait data pointer from the chunk's subject by its type identifier. More...
 
template<typename T >
const TTraitPtrAt (const int32 SlotIndex) const
 Get the trait data pointer from the chunk's subject by its type identifier. More...
 
template<typename T >
TTraitPtrAt (const int32 SlotIndex)
 Get the trait data pointer from the chunk's subject by its type identifier. More...
 
template<typename T >
const TTraitRefAt (const int32 SlotIndex) const
 Get a read-only trait reference from the chunk's subject by its type identifier. More...
 
template<typename T >
TTraitRefAt (const int32 SlotIndex)
 Get a trait reference from the chunk's subject by its type identifier. More...
 
const void * TraitPtrAtHinted (const int32 SlotIndex, UScriptStruct *const TraitType, int32 LineIndexHint) const
 Get the trait pointer given subject's index and a line index hint. More...
 
void * TraitPtrAtHinted (const int32 SlotIndex, UScriptStruct *const TraitType, int32 LineIndexHint)
 Get the trait pointer given subject's index and a line index hint. More...
 
template<typename T >
const TTraitPtrAtHinted (const int32 SlotIndex, int32 LineIndexHint) const
 Get the trait pointer given subject's index and a line index hint. More...
 
template<typename T >
TTraitPtrAtHinted (const int32 SlotIndex, int32 LineIndexHint)
 Get the trait pointer given subject's index and a line index hint. 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 UChunkNew (AMechanism *const Owner, const int32 Id, const FTraitmark &InTraitmark)
 Create a new chunk instance. More...
 
static bool IsValidChunk (const UChunk *const InChunk)
 

Protected Member Functions

void BeginDestroy () override
 Finalize the chunk, freeing all of its resources. More...
 
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 FSubjectInfo
 
struct FCommonSubjectHandle
 
struct FMechanicInfo
 
struct FFingerprint
 
class AMechanism
 
class UMachine
 
template<typename SubjectHandleT >
struct TChunkIt
 
template<typename ChunkItT , typename BeltItT , EParadigm Paradigm>
struct TChain
 

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 main containter for the subjects' traits.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidId 

Invalid chunk identifier.

FirstId 

First valid chunk identifier.

InvalidTraitLineIndex 

Invalid trait line index.

InvalidSlotIndex 

Invalid subject index.

Member Function Documentation

◆ At() [1/2]

FChunkSlot & UChunk::At ( const int32  SlotIndex)
inline

Get a slot at a certain position.

◆ At() [2/2]

const FChunkSlot & UChunk::At ( const int32  SlotIndex) const
inline

Get a slot at a certain position.

Constant version.

◆ Begin()

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

Begin iterating the chunk.

Template Parameters
ChunkItTThe type of the iterator to use.
Parameters
FilterThe filter to iterate under.
OffsetThe slot offset to begin with.
Returns
The iterator for the chunk.

◆ BeginDestroy()

void UChunk::BeginDestroy ( )
overrideprotected

Finalize the chunk, freeing all of its resources.

◆ Check()

bool UChunk::Check ( ) const

Check the validity of the chunk.

◆ DoUnlock()

EApparatusStatus UChunk::DoUnlock ( const bool  bWasSolid) const
overrideprotectedvirtual

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 ChunkItT >
ChunkItT UChunk::End ( ) const
inline

The ending iterator.

Template Parameters
ChunkItTThe type of the chunk iterator.
Returns
The ending iterator.

◆ FetchTraitsPtrs()

EApparatusStatus UChunk::FetchTraitsPtrs ( const int32  SlotIndex,
const TArray< int32 > &  Mapping,
void **  OutTraits 
)

Fetch the traits for a subject into a traits data array.

Parameters
SlotIndexThe index of the subject within the belt.
MappingThe mapping to use while fetching.
OutTraitsInitialized traits data to fill.
Returns
The status of the operation.

◆ FindTraitLine() [1/8]

template<typename T >
FScriptStructArray * UChunk::FindTraitLine ( )
inline

Find a trait line by the type of its element.

Templated version.

Template Parameters
TThe type of the traits to search for.
Returns
The trait line of the specified type.
nullptr If there is no such trait line in the chunk.

◆ FindTraitLine() [2/8]

template<>
FScriptStructArray * UChunk::FindTraitLine ( )
inline

◆ FindTraitLine() [3/8]

template<>
FScriptStructArray * UChunk::FindTraitLine ( )
inline

◆ FindTraitLine() [4/8]

template<typename T >
const FScriptStructArray * UChunk::FindTraitLine ( ) const
inline

Find a trait line by the type of its element.

Templated constant version.

Template Parameters
TThe type of the traits to search for.
Returns
The trait line of the specified type.
nullptr If there is no such trait line in the chunk.

◆ FindTraitLine() [5/8]

template<>
const FScriptStructArray * UChunk::FindTraitLine ( ) const
inline

◆ FindTraitLine() [6/8]

template<>
const FScriptStructArray * UChunk::FindTraitLine ( ) const
inline

◆ FindTraitLine() [7/8]

FScriptStructArray * UChunk::FindTraitLine ( UScriptStruct *const  TraitType)
inline

Find a trait line by the type of its element.

Parameters
TraitTypeThe type of the traits to search for.
Returns
The trait line of the specified type.
nullptr If there is no such line in the chunk.

◆ FindTraitLine() [8/8]

const FScriptStructArray * UChunk::FindTraitLine ( UScriptStruct *const  TraitType) const
inline

Find a trait line by the type of its element.

Constant version.

Parameters
TraitTypeThe type of the traits to search for.
Returns
The trait line of the specified type.
nullptr If there is no such line in the chunk.

◆ GetOwner()

AMechanism * UChunk::GetOwner ( ) const

Get the owning mechanism of the chunk.

◆ GetTraitLine() [1/2]

template<typename T >
const FScriptStructArray & UChunk::GetTraitLine ( ) const
inline

Get a trait line by the type of its element.

Templated version.

Template Parameters
TThe type of the trait to get by.
Returns
The trait line of the specified type.

◆ GetTraitLine() [2/2]

const FScriptStructArray & UChunk::GetTraitLine ( UScriptStruct *const  TraitType) const
inline

Get a trait line by the type of its element.

Parameters
TraitTypeThe type of the trait to get by.
Returns
The trait line of the specified type.

◆ GetTraitmark()

const FTraitmark & UChunk::GetTraitmark ( ) const
inline

Get the traitmark of the chunk.

◆ HasSubjectFlagAt()

bool UChunk::HasSubjectFlagAt ( const int32  SlotIndex,
const EFlagmarkBit  Flag 
) const
inline

Check a subject's flag at a specific slot index.

The operation is thread-safe and atomic.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Parameters
SlotIndexThe index of the subject slot to examine.
FlagThe flag to test.
Returns
The state of the flag.
See also
SetSubjectFlagAt(const int32, const EFlagmarkBit, const bool)

◆ IsSlotLocked()

bool UChunk::IsSlotLocked ( const int32  SlotIndex) const
inline

Check if the subject at specified place is locked.

Returns
The status of the examination.

◆ IsStaleAt()

bool UChunk::IsStaleAt ( const int32  SlotIndex) const
inline

Check if a slot is stale at a certain position.

Stale slots should generally be skipped during the iterating process.

Parameters
SlotIndexThe index of the subject slot to examine.
Returns
The status of the examination.

◆ IsValidChunk()

static bool UChunk::IsValidChunk ( const UChunk *const  InChunk)
inlinestatic

◆ Matches()

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

Check whether the chunk matches a filter.

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

Reimplemented from IIterable.

◆ New()

static UChunk * UChunk::New ( AMechanism *const  Owner,
const int32  Id,
const FTraitmark InTraitmark 
)
inlinestatic

Create a new chunk instance.

◆ operator[]() [1/2]

FChunkSlot & UChunk::operator[] ( const int32  SlotIndex)
inline

Get a slot at a certain position.

◆ operator[]() [2/2]

const FChunkSlot & UChunk::operator[] ( const int32  SlotIndex) const
inline

Get a slot at a certain position.

Constant version.

◆ OverwriteTraits() [1/3]

EApparatusStatus UChunk::OverwriteTraits ( const int32  SrcSlotIndex,
class UChunk *const  DstChunk,
const int32  DstSlotIndex 
)

Copy the traits from this chunk to another one, given subject indices.

If the trait is missing within the destination chunk it is safely skipped.

Parameters
SrcSlotIndexThe subject's index within the source chunk.
DstChunkThe destination chunk to copy to. May the same as the source (this).
DstSlotIndexThe subject's index within the destination chunk.
Returns
The status of the operation.

◆ OverwriteTraits() [2/3]

EApparatusStatus UChunk::OverwriteTraits ( const int32  SrcSlotIndex,
class UChunk *const  DstChunk,
const int32  DstSlotIndex 
) const

Copy the traits from this chunk to another one, given subject indices.

Constant version.

If the trait is missing within the destination chunk it is safely skipped.

Note
The constant version doesn't support copying to itself.
Parameters
SrcSlotIndexThe subject's index within the source chunk.
DstChunkThe destination chunk to copy to.
DstSlotIndexThe subject's index within the destination chunk.
Returns
The status of the operation.

◆ OverwriteTraits() [3/3]

EApparatusStatus UChunk::OverwriteTraits ( const int32  SrcSlotIndex,
const int32  DstSlotIndex 
)
inline

Copy the traits within the chunk, given subject indices.

Parameters
SrcSlotIndexThe subject's index to copy from.
DstSlotIndexThe subject's index to copy to.
Returns
The status of the operation.

◆ Reserve()

void UChunk::Reserve ( const int32  InCapacity)
inline

Reserve a certain capacity.

◆ SetSubjectFlagAt()

template<EParadigm Paradigm = EParadigm::Safe>
bool UChunk::SetSubjectFlagAt ( const int32  SlotIndex,
const EFlagmarkBit  Flag,
const bool  bState = true 
) const
inline

Set a subject's flag at a specific slot index.

The operation is thread-safe and atomic.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Template Parameters
ParadigmThe safety paradigm to utilize.
Parameters
SlotIndexThe index of the subject slot to examine.
FlagThe flag to set or reset.
bStateThe state of the flag to set to.
Returns
The previous state of the flag.
See also
HasSubjectFlagAt(const int32, const EFlagmarkBit)

◆ SetSubjectFlagmarkAt()

template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark UChunk::SetSubjectFlagmarkAt ( const int32  SlotIndex,
const EFlagmark  Flagmark 
) const
inline

Set a subject's flagmark at a specific slot index.

The operation is thread-safe and atomic.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Template Parameters
ParadigmThe safety paradigm to utilize.
Parameters
SlotIndexThe index of the subject slot to examine.
FlagmarkThe flagmark to set to.
Returns
The flagmark of the subject.

◆ SetSubjectFlagmarkMaskedAt()

template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark UChunk::SetSubjectFlagmarkMaskedAt ( const int32  SlotIndex,
const EFlagmark  Flagmark,
const EFlagmark  Mask 
)
inline

Set the masked flagmark for the subject.

This operation is atomic and thread-safe.

All of the system-level flags get removed from the mask argument prior to application.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Template Parameters
ParadigmThe safety paradigm to utilize.
Parameters
SlotIndexThe index of the subject slot to examine.
FlagmarkThe new flagmark to set to.
MaskThe mask to apply on the flagmark bits to set.
Returns
The previous flagmark of the subject.
See also
SetSubjectFlagmarkAt(const int32, const EFlagmark)

◆ SetTraitAt()

EApparatusStatus UChunk::SetTraitAt ( const int32  SlotIndex,
const UScriptStruct *const  TraitType,
const void *const  InTraitData 
)
inline

Set the trait for the chunk's subject by its type identifier.

Parameters
SlotIndexThe index of the subject within the chunk.
TraitTypeThe type of the trait to set.
InTraitDataThe trait data to set.
Returns
The status of the operation.

◆ SubjectAt()

template<typename SubjectHandleT = FSubjectHandle>
SubjectHandleT UChunk::SubjectAt ( const int32  SlotIndex) const
inline

Get a subject at a specific slot index.

Template Parameters
SubjectHandleTThe type of the handle to acquire.
Parameters
SlotIndexThe index of the subject to get.
Returns
The subject at the specified index.

◆ SubjectFingerprintAt()

const FFingerprint & UChunk::SubjectFingerprintAt ( const int32  SlotIndex) const
inline

Get a subject's fingerprint at a specific slot index.

The method is cache efficient during the iterating process, cause the fingerprints are stored within the chunk slots.

Parameters
SlotIndexThe index of the subject slot to examine.
Returns
The fingerprint of the subject.

◆ SubjectFlagmarkAt()

EFlagmark UChunk::SubjectFlagmarkAt ( const int32  SlotIndex) const
inline

Get a subject's flagmark at a specific slot index.

The operation is thread-safe and atomic.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Parameters
SlotIndexThe index of the subject slot to examine.
Returns
The flagmark of the subject.

◆ SwapTraits()

EApparatusStatus UChunk::SwapTraits ( const int32  SlotIndex,
class UChunk OtherChunk,
const int32  OtherSlotIndex,
const bool  bClearMissing = true 
)

Swap the traits from this chunk with another one, given subject indices.

If the trait is missing within the destination chunk it is safely skipped.

Parameters
SlotIndexThe subject's index within the source chunk.
OtherChunkThe destination chunk to copy to. May the same as the source (this).
OtherSlotIndexThe subject's index within the destination chunk.
bClearMissingClear the original traits missing within the other chunk.
Returns
The status of the operation.

◆ ToggleSubjectFlagAt()

template<EParadigm Paradigm = EParadigm::Safe>
bool UChunk::ToggleSubjectFlagAt ( const int32  SlotIndex,
const EFlagmarkBit  Flag 
) const
inline

Toggle a subject's flag at a specific slot index.

The operation is thread-safe and atomic.

The method is cache efficient during the iterating process, cause the flagmarks are stored within the chunk slots.

Template Parameters
ParadigmThe safety paradigm to utilize.
Parameters
SlotIndexThe index of the subject slot to examine.
FlagThe flag to toggle.
Returns
The previous state of the flag.
See also
SetSubjectFlagAt(const int32, const EFlagmarkBit, const bool)

◆ TraitAt() [1/4]

template<typename T >
T UChunk::TraitAt ( const int32  SlotIndex) const
inline

Get a copy of a trait from the chunk's subject by its type identifier.

Template Parameters
TThe type of the trait to copy.
Returns
The copy of the trait.

◆ TraitAt() [2/4]

template<typename T >
T UChunk::TraitAt ( const int32  SlotIndex,
const int32  LineIndex 
) const
inline

Get a copy of a trait given subject's index and a line index.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexAn index of the subject.
LineIndexAn index of the line.
Returns
The copy of the trait.

◆ TraitAt() [3/4]

EApparatusStatus UChunk::TraitAt ( const int32  SlotIndex,
const UScriptStruct *const  TraitType,
void *const  OutTraitData,
const bool  bTraitDataInitialized = true 
) const
inline

Copy a trait from the chunk's subject by its type identifier.

Parameters
SlotIndexThe index of the subject within the chunk.
TraitTypeThe trait type identifier.
OutTraitDataThe trait data receiver.
bTraitDataInitializedIs the OutTraitData actually initialized?
Returns
The status of the operation.
EApparatusStatus::NotFound If there's no such trait type in the chunk.

◆ TraitAt() [4/4]

EApparatusStatus UChunk::TraitAt ( const int32  SubjectIndex,
const int32  LineIndex,
void *const  OutTraitData,
bool  bTraitDataInitialized = true 
) const
inline

Copy a trait's data given a subject and line indices to a supplied data buffer.

Parameters
SubjectIndexThe index of the subject which trait to copy.
LineIndexThe index of the trait line.
OutTraitDataThe output buffer to copy to.
bTraitDataInitializedIs the trait data initialized or a raw buffer?
Returns
The status of the operation.

◆ TraitAtHinted() [1/2]

template<typename T >
T UChunk::TraitAtHinted ( const int32  SubjectIndex,
int32  LineIndexHint 
) const
inline

Get a copy of a trait given subject's index and a line index hint.

This is a low-level method without the remapping.

Template Parameters
TThe type of the trait to get.
Parameters
SubjectIndexThe index of the subject. Must be a valid one.
LineIndexHintThe hinting index of the trait line. May be a UChunk::InvalidTraitLineIndex for automatic line search.
Returns
The copy of the trait.

◆ TraitAtHinted() [2/2]

EApparatusStatus UChunk::TraitAtHinted ( const int32  SubjectIndex,
UScriptStruct *const  TraitType,
int32  LineIndexHint,
void *const  OutTraitData,
bool  bTraitDataInitialized = true 
) const
inline

Copy a trait's data given a subject and line indices to a supplied data buffer.

Parameters
SubjectIndexThe index of the subject which trait to copy. Must be a valid one.
TraitTypeThe type of the trait to get.
LineIndexHintThe hinting index of the trait line. May be a UChunk::InvalidTraitLineIndex for automatic line search.
OutTraitDataThe output buffer to copy to.
bTraitDataInitializedIs the trait data initialized or a raw buffer?
Returns
The status of the operation.

◆ TraitLineAt() [1/2]

FScriptStructArray & UChunk::TraitLineAt ( const int32  LineIndex)
inline

Get a trait line at a specific index.

Parameters
LineIndexAn index of the line.
Returns
The trait line at the specified index.

◆ TraitLineAt() [2/2]

const FScriptStructArray & UChunk::TraitLineAt ( const int32  LineIndex) const
inline

Get a trait line at a specific index.

Constant version.

Parameters
LineIndexAn index of the line.
Returns
The trait line at the specified index.

◆ TraitLineIndexOf() [1/2]

template<typename T >
constexpr int32 UChunk::TraitLineIndexOf ( ) const
inlineconstexpr

Get the trait line index of a trait.

Note
This method actually supports non-trait types and INDEX_NONE will be returned in such case.
Template Parameters
TThe type of the trait to find.
Returns
The index of the trait, or INDEX_NONE, if there is no such trait within the chunk.

◆ TraitLineIndexOf() [2/2]

int32 UChunk::TraitLineIndexOf ( UScriptStruct *const  TraitType) const
inline

Get the trait line index of a trait.

Parameters
TraitTypeThe type of the trait to find.
Returns
The index of the trait, or INDEX_NONE, if there is no such trait within the chunk.

◆ TraitLinesNum()

int32 UChunk::TraitLinesNum ( ) const
inline

The number of trait lines in the chunk.

Returns
The total number of trait lines in the chunk.

◆ TraitLineTraitSizeAt()

int32 UChunk::TraitLineTraitSizeAt ( const int32  LineIndex) const
inline

Get the size of a trait given its line index.

Parameters
LineIndexThe index of the line.
Returns
The size of the trait structure corresponding to the line.

◆ TraitLineTypeAt()

UScriptStruct * UChunk::TraitLineTypeAt ( const int32  LineIndex) const
inline

Get the type of a trait line.

Parameters
LineIndexAn index of the line.
Returns
The trait type of the line.

◆ TraitPtrAt() [1/6]

template<typename T >
T * UChunk::TraitPtrAt ( const int32  SlotIndex)
inline

Get the trait data pointer from the chunk's subject by its type identifier.

Templated version.

Template Parameters
TThe trait type identifier.
Parameters
SlotIndexThe index of the subject within the chunk.
Returns
A pointer to the trait data.

◆ TraitPtrAt() [2/6]

template<typename T >
const T * UChunk::TraitPtrAt ( const int32  SlotIndex) const
inline

Get the trait data pointer from the chunk's subject by its type identifier.

Templated constant version.

Template Parameters
TThe trait type identifier.
Parameters
SlotIndexThe index of the subject within the chunk.
Returns
A pointer to the trait data.

◆ TraitPtrAt() [3/6]

void * UChunk::TraitPtrAt ( const int32  SlotIndex,
const int32  LineIndex 
)
inline

Get the trait data pointer given subject's index and a line index.

Parameters
SlotIndexAn index of the subject slot.
LineIndexAn index of the line.
Returns
The data of the trait.

◆ TraitPtrAt() [4/6]

const void * UChunk::TraitPtrAt ( const int32  SlotIndex,
const int32  LineIndex 
) const
inline

Get the trait data pointer given subject's index and a line index.

Constant version.

Parameters
SlotIndexAn index of the subject.
LineIndexAn index of the line.
Returns
A read-only data of the trait.

◆ TraitPtrAt() [5/6]

const void * UChunk::TraitPtrAt ( const int32  SlotIndex,
const UScriptStruct *const  TraitType 
) const
inline

Get the read-only trait data pointer from the chunk's subject by its type identifier.

Constant version.

Parameters
SlotIndexThe index of the subject within the chunk.
TraitTypeThe trait type identifier. *
Returns
A pointer to the read-only trait data.
nullptr If there's no such trait in the chunk.

◆ TraitPtrAt() [6/6]

void * UChunk::TraitPtrAt ( const int32  SlotIndex,
UScriptStruct *const  TraitType 
)
inline

Get the trait data pointer from the chunk's subject by its type identifier.

Parameters
SlotIndexThe index of the subject within the chunk.
TraitTypeThe trait type identifier.
Returns
A pointer to the read-only trait data.
nullptr If there's no such trait in the chunk.

◆ TraitPtrAtHinted() [1/4]

template<typename T >
T * UChunk::TraitPtrAtHinted ( const int32  SlotIndex,
int32  LineIndexHint 
)
inline

Get the trait pointer given subject's index and a line index hint.

Templated version.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject.
LineIndexHintThe hint for the index of the line.
Returns
The pointer to the trait.

◆ TraitPtrAtHinted() [2/4]

template<typename T >
const T * UChunk::TraitPtrAtHinted ( const int32  SlotIndex,
int32  LineIndexHint 
) const
inline

Get the trait pointer given subject's index and a line index hint.

Constant templated version.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject.
LineIndexHintThe hint for the index of the line.
Returns
The pointer to the trait.

◆ TraitPtrAtHinted() [3/4]

void * UChunk::TraitPtrAtHinted ( const int32  SlotIndex,
UScriptStruct *const  TraitType,
int32  LineIndexHint 
)
inline

Get the trait pointer given subject's index and a line index hint.

Parameters
SlotIndexThe index of the subject.
TraitTypeThe type of the trait to get.
LineIndexHintThe hint for the index of the line.
Returns
The pointer to the trait data.

◆ TraitPtrAtHinted() [4/4]

const void * UChunk::TraitPtrAtHinted ( const int32  SlotIndex,
UScriptStruct *const  TraitType,
int32  LineIndexHint 
) const
inline

Get the trait pointer given subject's index and a line index hint.

Constant version.

Parameters
SlotIndexThe index of the subject.
TraitTypeThe type of the trait to get.
LineIndexHintThe hint for the index of the line.
Returns
The pointer to the trait data.

◆ TraitRefAt() [1/4]

template<typename T >
T & UChunk::TraitRefAt ( const int32  SlotIndex)
inline

Get a trait reference from the chunk's subject by its type identifier.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject within the chunk.
Returns
A reference for the trait.

◆ TraitRefAt() [2/4]

template<typename T >
const T & UChunk::TraitRefAt ( const int32  SlotIndex) const
inline

Get a read-only trait reference from the chunk's subject by its type identifier.

Constant version.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject within the chunk.
Returns
A reference for the read-only trait.

◆ TraitRefAt() [3/4]

template<typename T >
T & UChunk::TraitRefAt ( const int32  SlotIndex,
const int32  LineIndex 
)
inline

Get the trait reference given subject's index and a line index.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexAn index of the subject.
LineIndexAn index of the line.
Returns
The reference for the trait.

◆ TraitRefAt() [4/4]

template<typename T >
const T & UChunk::TraitRefAt ( const int32  SlotIndex,
const int32  LineIndex 
) const
inline

Get a trait reference given subject's index and a line index.

Constant version.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexAn index of the subject.
LineIndexAn index of the line.
Returns
The reference for the read-only trait.

◆ TraitRefAtHinted() [1/2]

template<typename T >
T & UChunk::TraitRefAtHinted ( const int32  SlotIndex,
int32  LineIndexHint 
)
inline

Get the trait reference given subject's index and a line index hint.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject.
LineIndexHintThe hint for the index of the line.
Returns
The reference for the trait.

◆ TraitRefAtHinted() [2/2]

template<typename T >
const T & UChunk::TraitRefAtHinted ( const int32  SlotIndex,
int32  LineIndexHint 
) const
inline

Get the trait reference given subject's index and a line index hint.

Constant version.

Template Parameters
TThe type of the trait to get.
Parameters
SlotIndexThe index of the subject.
LineIndexHintThe hint for the index of the line.
Returns
The reference for the trait.

Friends And Related Function Documentation

◆ AMechanism

friend class AMechanism
friend

◆ FCommonSubjectHandle

friend struct FCommonSubjectHandle
friend

◆ FFingerprint

friend struct FFingerprint
friend

◆ FMechanicInfo

friend struct FMechanicInfo
friend

◆ FSubjectInfo

FSubjectInfo
friend

◆ TChain

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

◆ TChunkIt

template<typename SubjectHandleT >
friend struct TChunkIt
friend

◆ UMachine

friend class UMachine
friend

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