31 template <
typename... Components>
56 static_assert(
sizeof...(Components) > 0,
"[SurveyHandle] Must be queried for at least one component type.");
59 _smallestPool = _pools[0];
61 if (pool->get_size() < _smallestPool->get_size()) {
86 while (_index < _entities->size() && !matches_all((*_entities)[_index])) {
97 bool matches_all(
Entity e)
const
113 const std::vector<Entity>* _entities;
115 const std::array<
SparseSetBase*,
sizeof...(Components)>* _pools;
125 Iterator(
const std::vector<Entity>* entities,
size_t index,
const std::array<
SparseSetBase*,
sizeof...(Components)>* pools)
126 : _entities(entities), _index(index), _pools(pools)
139 return (*_entities)[_index];
161 return _index != other._index;
173 return Iterator(&_smallestPool->get_entities(), 0, &_pools);
181 return Iterator(&_smallestPool->get_entities(), _smallestPool->get_size(), &_pools);
Defines the Entity alias and the free functions used to pack and unpack it.
uint32_t Entity
A packed identifier: 20 bits of index, 12 bits of generation.
Definition Entity.hpp:20
Declares the SparseSetBase interface.
Type-erased interface for SparseSet<T>.
Definition SparseSetBase.hpp:21
Definition SurveyHandle.hpp:75
Iterator & operator++()
Advances the Iterator to the next element, skipping indices that represent Entities not in every pool...
Definition SurveyHandle.hpp:146
Entity operator*() const
Dereference the iterator to access the current element.
Definition SurveyHandle.hpp:137
Iterator(const std::vector< Entity > *entities, size_t index, const std::array< SparseSetBase *, sizeof...(Components)> *pools)
Construct a new Iterator object.
Definition SurveyHandle.hpp:125
bool operator!=(const Iterator &other) const
Checks whether two iterators point to different positions.
Definition SurveyHandle.hpp:159
Iterator begin() const
Returns an Iterator to the first element.
Definition SurveyHandle.hpp:171
SurveyHandle(const std::array< SparseSetBase *, sizeof...(Components)> &pools)
Constructs a new Survey object by defining _pools and iterating through them to find the smallest poo...
Definition SurveyHandle.hpp:52
Iterator end() const
Returns an Iterator past the last element.
Definition SurveyHandle.hpp:179