struct
Archetype
Entities sharing a component signature. Every entity with signature S lives in exactly one Archetype keyed by S, and its columns are the only storage for those components. AddComponent / RemoveComponent migrate the entity's data to another archetype, which invalidates any component pointer held across it.
- Module
- ECS
- Header
#include "ECS/Archetype.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
std::bitset<MAX_COMPONENTS> | signature | |
std::unordered_map<ComponentID, std::unique_ptr<IComponentColumn>> | columns | |
std::array<IComponentColumn*, MAX_COMPONENTS> | columnIndex | Dense ComponentID-indexed view of columns so the read hot path resolves a column with one array index instead of a hashed lookup. Kept in sync by PutColumn — columns are only ever added to an archetype, never removed. |
std::vector<EntityID> | entities | Positions here correspond 1:1 with row indices into every column. |
std::vector<uint32_t> | slots | The World slot of each row's entity, parallel to entities. A swap-remove fixes the moved entity's row through it with an index, and a ForEach hands it to Entity as a lookup hint — where a reverse id → row hash map used to be. |
Public functions
| Returns | Name | Description |
|---|---|---|
IComponentColumn* | Column | |
T* | ColumnData | Start of T's column, or null when this archetype does not carry T — how a chunk pass reads an optional component without a per-entity lookup. |
void | PutColumn |
Function details
Column
C++
IComponentColumn* Column(ComponentID cid) constColumnData
C++
template<typename T> T* ColumnData() constStart of T's column, or null when this archetype does not carry T — how a chunk pass reads an optional component without a per-entity lookup.
PutColumn
C++
void PutColumn(ComponentID cid, std::unique_ptr<IComponentColumn> col)Generated from ECS/Archetype.h via ecs.json · Nov 4, 2026Version 1.0.0