class final
#include <core/ecs/table/dense/table.hpp>
DenseTable Stores the dense data associated to entities of a given archetype.
Constructors, destructors, conversion operators
- DenseTable() defaulted
- Constructs a table without columns.
Public functions
-
void addColumn(ColumnId id,
const reflection::
Type& type) - Adds a new column to the table.
- void pushBack(uint32_t index)
- Inserts a new entity to the end of the table.
- void swapErase(uint32_t index)
- Removes an entity from the table.
- void swapMove(uint32_t index, DenseTable& other)
- Moves an entity from this table into another table, effectively calling pushBack() on the other table, and swapErase() on this one.
- auto row(uint32_t index) const -> std::size_t
- Gets the row which contains the data for the given entity.
- auto entity(std::size_t row) const -> uint32_t
- Gets the index of the entity which is stored in the given row.
- auto size() const -> std::size_t
- Gets the number of rows in the table.
-
auto column(ColumnId id) -> memory::
AnyVector& - Gets a reference to the column with the given
id
. -
auto column(ColumnId id) const -> const memory::
AnyVector& - Gets a reference to the column with the given
id
. - auto contains(ColumnId id) const -> bool
- Checks if the table has a column with the given
id
.
Function documentation
void cubos:: core:: ecs:: DenseTable:: addColumn(ColumnId id,
const reflection:: Type& type)
Adds a new column to the table.
Parameters | |
---|---|
id | Column type identifier. |
type | Column data type. |
The table must still be empty, and the column must not already exist in the table.
void cubos:: core:: ecs:: DenseTable:: swapMove(uint32_t index,
DenseTable& other)
Moves an entity from this table into another table, effectively calling pushBack() on the other table, and swapErase() on this one.
Parameters | |
---|---|
index | Entity index. |
other | Destination table. |
std::size_t cubos:: core:: ecs:: DenseTable:: size() const
Gets the number of rows in the table.
Returns | Number of rows. |
---|
memory:: AnyVector& cubos:: core:: ecs:: DenseTable:: column(ColumnId id)
Gets a reference to the column with the given id
.
Parameters | |
---|---|
id | Column identifier. |
Returns | Column reference. |
Aborts if the column does not exist in the table.
const memory:: AnyVector& cubos:: core:: ecs:: DenseTable:: column(ColumnId id) const
Gets a reference to the column with the given id
.
Parameters | |
---|---|
id | Column identifier. |
Returns | Column reference. |
Aborts if the column does not exist in the table.