Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::ecs::ViewIterator< Components > Class Template Reference

Iterator for multi-component views. More...

#include <View.hpp>

Public Types

using PoolsTuple = std::tuple<SparseSet<Components>*...>
 Tuple type holding pointers to all component pools.

Public Member Functions

 ViewIterator (const std::vector< Entity > *entities, usize index, PoolsTuple pools)
 Constructs an iterator.
Entity operator* () const
 Dereferences to get the current entity.
ViewIterator & operator++ ()
 Advances to the next matching entity.
bool operator!= (const ViewIterator &other) const
 Inequality comparison.
bool operator== (const ViewIterator &other) const
 Equality comparison.

Detailed Description

template<typename... Components>
class esengine::ecs::ViewIterator< Components >

Iterator for multi-component views.

Template Parameters
ComponentsThe component types required

Iterates over entities from the smallest pool while filtering for entities that have all required components. Automatically skips entities that don't match the full component set.

Definition at line 49 of file View.hpp.

Member Typedef Documentation

◆ PoolsTuple

template<typename... Components>
using esengine::ecs::ViewIterator< Components >::PoolsTuple = std::tuple<SparseSet<Components>*...>

Tuple type holding pointers to all component pools.

Definition at line 52 of file View.hpp.

Constructor & Destructor Documentation

◆ ViewIterator()

template<typename... Components>
esengine::ecs::ViewIterator< Components >::ViewIterator ( const std::vector< Entity > * entities,
usize index,
PoolsTuple pools )
inline

Constructs an iterator.

Parameters
entitiesPointer to the entity array being iterated
indexCurrent position in the entity array
poolsTuple of component pool pointers

Definition at line 60 of file View.hpp.

Member Function Documentation

◆ operator!=()

template<typename... Components>
bool esengine::ecs::ViewIterator< Components >::operator!= ( const ViewIterator< Components > & other) const
inline

Inequality comparison.

Parameters
otherIterator to compare with
Returns
True if iterators are at different positions

Definition at line 97 of file View.hpp.

◆ operator*()

template<typename... Components>
Entity esengine::ecs::ViewIterator< Components >::operator* ( ) const
inline

Dereferences to get the current entity.

Returns
The current entity ID

Definition at line 72 of file View.hpp.

◆ operator++()

template<typename... Components>
ViewIterator & esengine::ecs::ViewIterator< Components >::operator++ ( )
inline

Advances to the next matching entity.

Returns
Reference to this iterator

Definition at line 86 of file View.hpp.

◆ operator==()

template<typename... Components>
bool esengine::ecs::ViewIterator< Components >::operator== ( const ViewIterator< Components > & other) const
inline

Equality comparison.

Parameters
otherIterator to compare with
Returns
True if iterators are at the same position

Definition at line 106 of file View.hpp.


The documentation for this class was generated from the following file:
  • /home/runner/work/estella/estella/src/esengine/ecs/View.hpp