10 template <Val
idEntity EntityType,
typename ComponentType>
16 typedef typename container_type::iterator
iterator;
34 m_components.push_back(component);
42 std::swap(m_components[
index], m_components.back());
43 m_components.pop_back();
50 std::out_of_range(
"Entity does not have component");
57 std::out_of_range(
"Entity does not have component");
77 return m_components.size();
Definition: ComponentStorage.hpp:12
ComponentType * tryGet(EntityType entity)
Definition: ComponentStorage.hpp:61
const_iterator begin() const
Definition: ComponentStorage.hpp:81
const ComponentType & get(EntityType entity) const
Definition: ComponentStorage.hpp:54
const_reverse_iterator rend() const
Definition: ComponentStorage.hpp:88
ComponentStorage & operator=(ComponentStorage &other)=default
std::vector< ComponentType > container_type
Definition: ComponentStorage.hpp:14
ComponentStorage(ComponentStorage &&other)=default
void insert(EntityType entity, ComponentType component)
Definition: ComponentStorage.hpp:29
container_type::const_iterator const_iterator
Definition: ComponentStorage.hpp:17
container_type::reverse_iterator reverse_iterator
Definition: ComponentStorage.hpp:18
container_type::iterator iterator
Definition: ComponentStorage.hpp:16
ComponentType & get(EntityType entity)
Definition: ComponentStorage.hpp:47
const_reverse_iterator rbegin() const
Definition: ComponentStorage.hpp:86
ComponentStorage(ComponentStorage &other)=default
reverse_iterator rend()
Definition: ComponentStorage.hpp:87
iterator begin()
Definition: ComponentStorage.hpp:80
~ComponentStorage()
Definition: ComponentStorage.hpp:22
const ComponentType * tryGet(EntityType entity) const
Definition: ComponentStorage.hpp:68
container_type::const_reverse_iterator const_reverse_iterator
Definition: ComponentStorage.hpp:19
size_t remove(EntityType entity) override
Definition: ComponentStorage.hpp:37
ComponentStorage()
Definition: ComponentStorage.hpp:21
reverse_iterator rbegin()
Definition: ComponentStorage.hpp:85
iterator end()
Definition: ComponentStorage.hpp:82
size_t size() const
Definition: ComponentStorage.hpp:75
SparseSet< EntityType > base_type
Definition: ComponentStorage.hpp:15
ComponentStorage & operator=(ComponentStorage &&other)=default
const_iterator end() const
Definition: ComponentStorage.hpp:83
Definition: SparseSet.hpp:20
size_t index(entityType entity) const
Definition: SparseSet.hpp:114
size_t insert(entityType entity)
Definition: SparseSet.hpp:41
virtual size_t remove(entityType entity)
Definition: SparseSet.hpp:57
bool contains(entityType entity) const
Definition: SparseSet.hpp:120
Definition: ComponentStorage.hpp:9
uint32_t entity
Definition: ecs_CONSTANTS.hpp:10