Sein Component Storage
C++ type · ISeinComponentStorage
#include "Simulation/ComponentStorage.h"
Abstract interface for entity-handle-keyed component storage.
C++ members (22)
void AddComponent(FSeinEntityHandle Handle, const void* ComponentData);void RemoveComponent(FSeinEntityHandle Handle);bool HasComponent(FSeinEntityHandle Handle) const;void* GetComponentRaw(FSeinEntityHandle Handle);const void* GetComponentRaw(FSeinEntityHandle Handle) const;void* GetComponentRawForDeferredMutation(FSeinEntityHandle Handle);Mutable access that does not count as a change. The caller must call CommitDeferredMutation exactly once, on the serial spine, when the payload actually changed. Intended for disjoint-write parallel kernels; ordinary callers use GetComponentRaw.void CommitDeferredMutation(FSeinEntityHandle Handle);Publish an actual write obtained through GetComponentRawForDeferredMutation. Not thread-safe.int32 GetComponentCount() const;void Clear();uint64 GetLatestMutationRevision() const;Change counters derived caches use to notice edits. Not simulation state.uint64 GetTopologyRevision() const;Changes whenever the occupied-handle set or storage capacity changes.void ForEachLiveComponent(TFunctionRef<void(FSeinEntityHandle , void* )> Visitor);Sparse live-slot iteration: invoke Visitor for every alive slot exactly once, in SLOT-INDEX ASCENDING order, handing it the exact generational handle stored with that slot and a mutable pointer to its raw payload. The order is the pool’s slot order. UnlikeFSeinEntityPool::ForEachEntity it visits abstract entities too. The entity pool remains the authority for whether the yielded handle is alive. Consumers must validate that exact handle before mutating entity state; they must never replace its generation with the pool’s current generation for the slot. Contract: the Visitor must NOT add or remove components of THIS storage during iteration (it walks the live bit-array in place). Deferring destroys / instance-effect removals is fine — those mutate the pool’s pending list or a payload’s inner array, not this storage’s slot set.void ForEachLiveComponent(TFunctionRef<void( FSeinEntityHandle , const void* )> Visitor) const;Read-only sparse live-slot iteration with the same ascending-slot and generational-handle guarantees as the mutable overload.const TBitArray<>& GetLiveSlotBits() const;Live-slot occupancy bits, indexed by entity slot. Iterating set bits ascending matches ForEachLiveComponent’s deterministic order. The reference is invalidated by any structural change (add/remove/Grow).int32 GetGenerationAtSlot(int32 SlotIndex) const;Stored generation for a slot; 0 when the slot holds no component.const void* GetRawAtSlot(int32 SlotIndex) const;Read-only payload at a live slot; nullptr when the slot is not live.void* GetMutableRawAtSlot(int32 SlotIndex);Mutable payload at a live slot with the conservative revision touch (same contract as handle-keyed GetComponentRaw).void* GetDeferredMutationRawAtSlot(int32 SlotIndex);Mutable payload at a live slot WITHOUT the revision touch — the caller must call CommitDeferredMutation on the serial spine iff deterministic state actually changed (same contract as the handle-keyed variant).void RemoveAllForEntity(FSeinEntityHandle Handle);Alias for RemoveComponent — clearer intent when cleaning up a destroyed entity.void Grow(int32 NewCapacity);Grow internal arrays to accommodate a larger entity pool.void CollectReferences(FReferenceCollector& Collector, UObject* Owner);Walk every alive slot’s payload and report its reflected UObject references to the GC. Without this, any TObjectPtr / UPROPERTY-tagged object ref stored inside a component struct is invisible to the collector (the backing buffer is a raw byte array) and the referenced UObject gets collected mid-play, leaving dangling pointers in ActiveAbility / AbilityInstances / Resolver / etc. Owner is the UObject the subsystem passes through for diagnostic attribution.UScriptStruct* GetStructType() const;