template<typename T>
engine::ecs::ComponentStorage class

Implementation of the interface for a given type.

Base classes

class IComponentStorage
Base interface for generic storage.

Public functions

void Add(EntityID entity, T component)
Stores the component for the given entity.
auto Get(EntityID entity) -> T&
Returns the component for the given entity.
void Remove(EntityID entity) override
Removes the entity from this given storage.
auto Has(EntityID entity) -> bool
Returns if the entity is in the storage.

Function documentation

template<typename T>
void engine::ecs::ComponentStorage<T>::Add(EntityID entity, T component)

Stores the component for the given entity.

Parameters
entity The entity to store the component on.
component The component being added.

template<typename T>
T& engine::ecs::ComponentStorage<T>::Get(EntityID entity)

Returns the component for the given entity.

Returns the component.

template<typename T>
void engine::ecs::ComponentStorage<T>::Remove(EntityID entity) override

Removes the entity from this given storage.

Parameters
entity The entity to remove.

template<typename T>
bool engine::ecs::ComponentStorage<T>::Has(EntityID entity)

Returns if the entity is in the storage.

Returns whether or not the entity is found in this storage.