ImagoEngine
A C++ 2D game engine built on a sparse-set ECS, with scenes, scheduled systems, events, and action-based input
Loading...
Searching...
No Matches
Imago::ECS::SurveyHandle< Components > Class Template Reference

The Survey takes Components as templated arguments and acts as an iterator over all entities with all component types. More...

#include <Imago/ECS/SurveyHandle.hpp>

Classes

class  Iterator

Public Member Functions

 SurveyHandle (const std::array< SparseSetBase *, sizeof...(Components)> &pools)
 Constructs a new Survey object by defining _pools and iterating through them to find the smallest pool.
Iterator begin () const
 Returns an Iterator to the first element.
Iterator end () const
 Returns an Iterator past the last element.

Detailed Description

template<typename... Components>
class Imago::ECS::SurveyHandle< Components >

The Survey takes Components as templated arguments and acts as an iterator over all entities with all component types.

Survey defines an Iterator inner class so that iterating with for loops is safe. As it iterates it skips over any index that represents an Entity that is not in every single component pool.

Template Parameters
Componentsto survey

Constructor & Destructor Documentation

◆ SurveyHandle()

template<typename... Components>
Imago::ECS::SurveyHandle< Components >::SurveyHandle ( const std::array< SparseSetBase *, sizeof...(Components)> & pools)
inlineexplicit

Constructs a new Survey object by defining _pools and iterating through them to find the smallest pool.

Will only be called by the Nexus where the Nexus will send pointers to the pools that it owns.

Parameters
poolsthe array of SparseSetBase* that makes up the pools for the particular Survey.

The documentation for this class was generated from the following file: