Apparatus Version 1.23
ECS data-oriented workflow for Unreal Engine.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
UChunk Class Reference

The main container 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.
 
AMechanismGetOwner () const
 Get the owning mechanism of the chunk.
 
bool IsSlotLocked (const int32 SlotIndex) const
 Check if the subject at specified place is locked.
 
void Reserve (const int32 InCapacity)
 Reserve a certain capacity within the chunk.
 
template<typename ChunkItT >
ChunkItT Begin (const FFilter &Filter, const int32 Offset=0)
 Begin iterating the chunk.
 
template<typename ChunkItT >
ChunkItT End () const
 The ending iterator.
 
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.
 
EApparatusStatus FetchTraitsPtrs (const int32 SlotIndex, const TArray< int32 > &Mapping, void **OutTraits)
 Fetch the traits for a subject into a traits data array.
 
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.
 
EApparatusStatus OverwriteTraits (const int32 SrcSlotIndex, class UChunk *const DstChunk, const int32 DstSlotIndex)
 Copy the traits from this chunk to another one, given subject indices.
 
template<EParadigm Paradigm = EParadigm::DefaultInternal>
TOutcome< Paradigm > 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.
 
EApparatusStatus OverwriteTraits (const int32 SrcSlotIndex, const int32 DstSlotIndex)
 Copy the traits within the chunk, given subject indices.
 
bool Matches (const FFilter &Filter) const override
 Check whether the chunk matches a filter.
 
bool Check () const
 Check the validity of the chunk.
 
FString ToString () const
 Get a textural representation of the chunk.
 
Slots
const FChunkSlotAt (const int32 SlotIndex) const
 Get a slot at a certain position.
 
FChunkSlotAt (const int32 SlotIndex)
 Get a slot at a certain position.
 
const FChunkSlotoperator[] (const int32 SlotIndex) const
 Get a slot at a certain position.
 
FChunkSlotoperator[] (const int32 SlotIndex)
 Get a slot at a certain position.
 
bool IsStaleAt (const int32 SlotIndex) const
 Check if a slot is stale at a certain position.
 
Subjects
template<typename SubjectHandleT = FSubjectHandle>
SubjectHandleT SubjectAt (const int32 SlotIndex) const
 Get a subject at a specific slot index.
 
const FFingerprintSubjectFingerprintAt (const int32 SlotIndex) const
 Get a subject's fingerprint at a specific slot index.
 
EFlagmark SubjectFlagmarkAt (const int32 SlotIndex) const
 Get a subject's flagmark at a specific slot index.
 
bool HasSubjectFlagAt (const int32 SlotIndex, const EFlagmarkBit Flag) const
 Check a subject's flag at a specific slot index.
 
template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark SetSubjectFlagmarkAt (const int32 SlotIndex, const EFlagmark Flagmark) const
 Set a subject's flagmark at a specific slot index.
 
template<EParadigm Paradigm = EParadigm::Safe>
EFlagmark SetSubjectFlagmarkMaskedAt (const int32 SlotIndex, const EFlagmark Flagmark, const EFlagmark Mask)
 Set the masked flagmark for the subject.
 
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.
 
template<EParadigm Paradigm = EParadigm::Safe>
bool ToggleSubjectFlagAt (const int32 SlotIndex, const EFlagmarkBit Flag) const
 Toggle a subject's flag at a specific slot index.
 
Trait Lines
UScriptStruct * TraitLineTypeAt (const int32 LineIndex) const
 Get the type of a trait line.
 
int32 TraitLinesNum () const
 The number of trait lines in the chunk.
 
int32 TraitLineTraitSizeAt (const int32 LineIndex) const
 Get the size of a trait given its line index.
 
const FScriptStructArrayGetTraitLine (UScriptStruct *const TraitType) const
 Get a trait line by the type of its element.
 
template<typename T >
const FScriptStructArrayGetTraitLine () const
 Get a trait line by the type of its element.
 
const FScriptStructArrayTraitLineAt (const int32 LineIndex) const
 Get a trait line at a specific index.
 
FScriptStructArrayTraitLineAt (const int32 LineIndex)
 Get a trait line at a specific index.
 
bool HasTraitLine (UScriptStruct *const TraitType) const
 Check if a trait line is within the chunk.
 
const FScriptStructArrayFindTraitLine (UScriptStruct *const TraitType) const
 Find a trait line by the type of its element.
 
FScriptStructArrayFindTraitLine (UScriptStruct *const TraitType)
 Find a trait line by the type of its element.
 
template<typename T >
std::enable_if< IsTraitType< T >(), constFScriptStructArray * >::type FindTraitLine () const
 Find a trait line by the type of its element.
 
template<typename T >
std::enable_if< IsTraitType< T >(), FScriptStructArray * >::type FindTraitLine ()
 Find a trait line by the type of its element.
 
int32 TraitLineIndexOf (UScriptStruct *const TraitType) const
 Get the trait line index of a trait.
 
template<typename T >
constexpr int32 TraitLineIndexOf () const
 Get the trait line index of a trait.
 
Traits Access
EApparatusStatus TraitAt (const int32 SlotIndex, 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.
 
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.
 
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.
 
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.
 
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.
 
template<typename T >
T TraitAt (const int32 SlotIndex) const
 Get a copy of a trait from the chunk's subject by its type identifier.
 
Traits Data Access
const void * TraitPtrAt (const int32 SlotIndex, const int32 LineIndex) const
 Get the trait data pointer given subject's index and a line index.
 
void * TraitPtrAt (const int32 SlotIndex, const int32 LineIndex)
 Get the trait data pointer given subject's index and a line index.
 
void * TraitPtrAt (UScriptStruct *const TraitTypeCheck, const int32 SlotIndex, const int32 LineIndex)
 Get the trait data pointer given subject's index and a line index.
 
template<typename T >
const TTraitRefAt (const int32 SlotIndex, const int32 LineIndex) const
 Get a trait reference given subject's index and a line index.
 
template<typename T >
TTraitRefAt (const int32 SlotIndex, const int32 LineIndex)
 Get the trait reference given subject's index and a line index.
 
template<typename T >
const TTraitRefAtHinted (const int32 SlotIndex, int32 LineIndexHint) const
 Get the trait reference given subject's index and a line index hint.
 
template<typename T >
TTraitRefAtHinted (const int32 SlotIndex, int32 LineIndexHint)
 Get the trait reference given subject's index and a line index hint.
 
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.
 
void * TraitPtrAt (const int32 SlotIndex, UScriptStruct *const TraitType)
 Get the trait data pointer from the chunk's subject by its type identifier.
 
template<typename T >
const TTraitPtrAt (const int32 SlotIndex) const
 Get the trait data pointer from the chunk's subject by its type identifier.
 
template<typename T >
TTraitPtrAt (const int32 SlotIndex)
 Get the trait data pointer from the chunk's subject by its type identifier.
 
template<typename T >
const TTraitRefAt (const int32 SlotIndex) const
 Get a read-only trait reference from the chunk's subject by its type identifier.
 
template<typename T >
TTraitRefAt (const int32 SlotIndex)
 Get a trait reference from the chunk's subject by its type identifier.
 
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.
 
void * TraitPtrAtHinted (const int32 SlotIndex, UScriptStruct *const TraitType, int32 LineIndexHint)
 Get the trait pointer given subject's index and a line index hint.
 
template<typename T >
const TTraitPtrAtHinted (const int32 SlotIndex, int32 LineIndexHint) const
 Get the trait pointer given subject's index and a line index hint.
 
template<typename T >
TTraitPtrAtHinted (const int32 SlotIndex, int32 LineIndexHint)
 Get the trait pointer given subject's index and a line index hint.
 
- Public Member Functions inherited from IIterable
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.
 
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.
 

Static Public Member Functions

static UChunkNew (AMechanism *const Owner, const int32 Id, const FTraitmark &InTraitmark)
 Create a new chunk instance.
 
static bool IsValidChunk (const UChunk *const InChunk)
 

Protected Member Functions

void BeginDestroy () override
 Finalize the chunk, freeing all of its resources.
 
EApparatusStatus DoUnlock (const bool bWasSolid) const override
 Unlock the iterable, applying the pending changes.
 
- Protected Member Functions inherited from IIterable
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.
 

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

Detailed Description

The main container 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.

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 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/4]

template<typename T >
std::enable_if< IsTraitType< T >(), FScriptStructArray * >::type 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/4]

template<typename T >
std::enable_if< IsTraitType< T >(), constFScriptStructArray * >::type 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() [3/4]

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() [4/4]

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)

◆ HasTraitLine()

bool UChunk::HasTraitLine ( UScriptStruct *const  TraitType) const
inline

Check if a trait line is within the chunk.

Parameters
TraitTypeThe type of the trait to check against. May not be a nullptr.
Returns
The state of examination.

◆ 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 within the chunk.

◆ 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()

template<EParadigm Paradigm = EParadigm::DefaultInternal>
TOutcome< Paradigm > 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.

Template Parameters
ParadigmThe paradigm to work under.
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 outcome 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)

◆ ToString()

FString UChunk::ToString ( ) const
inline

Get a textural representation of the chunk.

Returns
The textual representation of the chunk.

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

Statically typed version.

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 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
[in]SlotIndexThe index of the subject which trait to copy.
[in]LineIndexThe index of the trait line.
[out]OutTraitDataThe output buffer to copy to.
[in]bTraitDataInitializedIs the trait data initialized or a raw buffer?
Returns
The status of the operation.

◆ TraitAt() [4/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
[in]SlotIndexThe index of the subject within the chunk.
[in]TraitTypeThe trait type identifier.
[out]OutTraitDataThe trait data receiver.
[in]bTraitDataInitializedIs the OutTraitData actually initialized?
Returns
The status of the operation.
EApparatusStatus::Missing If there's no such trait type in the chunk.

◆ 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/7]

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/7]

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/7]

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

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

Generic mutable data version.

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

◆ TraitPtrAt() [4/7]

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.

Generic constant data version.

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

◆ TraitPtrAt() [5/7]

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.

Dynamically-typed constant data 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/7]

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

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

Dynamically-typed mutable data 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() [7/7]

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

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

Generic mutable data version.

Parameters
TraitTypeCheckThe type to check.
SlotIndexAn index of the subject slot.
LineIndexAn index of the line.
Returns
The data of the trait.

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

Statically-typed mutable version.

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.

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

Statically typed mutable 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 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.

Statically typed 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: