11#include "Registry.hpp"
21 template<
typename... Components>
24 using Tuple = std::tuple<size_t, Components &...>;
94 template<
typename Component,
typename... Others>
98 bool hasAllComponents =
true;
100 if (component ==
nullptr) {
101 hasAllComponents =
false;
103 if (hasAllComponents) {
104 if constexpr (
sizeof...(Others) > 0) {
108 if (hasAllComponents)
return;
Registry class, used to store and manage entities and their components.
Definition: Registry.hpp:26
size_t getEntityCounter() const
Get the counter used to generate new entity ids.
Definition: Registry.hpp:335
SparseArray< Component >::ReferenceType getComponent(const Entity &e)
Get a component from an entity.
Definition: Registry.hpp:214
Iterator class for the view.
Definition: View.hpp:35
Tuple operator->()
Postfix increment operator.
Definition: View.hpp:62
bool operator!=(const Iterator &other) const
Inequality operator.
Definition: View.hpp:82
void skipInvalidEntities()
Skip all the entities that don't have all the components.
Definition: View.hpp:95
Iterator(ecs::Registry ®istry)
Construct a new Iterator object.
Definition: View.hpp:41
Tuple operator*()
Dereference operator.
Definition: View.hpp:68
bool operator==(const Iterator &other) const
Equality operator.
Definition: View.hpp:75
ecs::Registry _registry
The registry to iterate over.
Definition: View.hpp:87
Iterator & operator++()
Prefix increment operator.
Definition: View.hpp:51
A view is a way to iterate over a set of entities that have a specific set of components.
Definition: View.hpp:22
Iterator end()
Get the end iterator.
Definition: View.hpp:125
View(ecs::Registry ®istry)
Construct a new View object.
Definition: View.hpp:30
std::tuple< size_t, Components &... > Tuple
The tuple type that will be returned by the iterators.
Definition: View.hpp:24
Iterator begin()
Get the begin iterator.
Definition: View.hpp:119
Registry _registry
The registry to iterate over.
Definition: View.hpp:133
Namespace containing all the ECS related classes.
Definition: Components.hpp:21