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::SparseSetBase Class Referenceabstract

Type-erased interface for SparseSet<T>. More...

#include <Imago/ECS/SparseSetBase.hpp>

Inheritance diagram for Imago::ECS::SparseSetBase:

Public Member Functions

virtual void remove (Entity e)=0
 removes an Entity's component from this pool, if it is currently present
virtual bool has (Entity e) const =0
 checks whether an Entity currently has a component stored in this pool
virtual size_t get_size () const =0
 return the number of Entities currently stored in this pool
virtual const std::vector< Entity > & get_entities () const =0
 returns the dense array of entities currently stored in this pool
virtual size_t get_index (Entity e) const =0
 Returns the index of the specified Entity.
virtual void swap_entities (Entity e1, Entity e2)=0
 Swaps e1 with e2 in _dense, _entities, and _sparse.

Detailed Description

Type-erased interface for SparseSet<T>.

Lets Nexus store pools of different component types behind a single pointer type without knowing what T any given pool actually holds. SparseSet<T> is the only intended implementation of this interface.

Member Function Documentation

◆ get_entities()

virtual const std::vector< Entity > & Imago::ECS::SparseSetBase::get_entities ( ) const
pure virtual

returns the dense array of entities currently stored in this pool

Returns
the dense array of Entities

Implemented in Imago::ECS::SparseSet< T >.

◆ get_index()

virtual size_t Imago::ECS::SparseSetBase::get_index ( Entity e) const
pure virtual

Returns the index of the specified Entity.

Parameters
eThe entity's whose index to return.

Implemented in Imago::ECS::SparseSet< T >.

◆ get_size()

virtual size_t Imago::ECS::SparseSetBase::get_size ( ) const
pure virtual

return the number of Entities currently stored in this pool

Returns
the number of Entitities currently stored in the pool

Implemented in Imago::ECS::SparseSet< T >.

◆ has()

virtual bool Imago::ECS::SparseSetBase::has ( Entity e) const
pure virtual

checks whether an Entity currently has a component stored in this pool

Parameters
ethe Entity to check
Returns
true if the Entity has a component stored in this pool
false if the Entity does not have a component stored in this pool

Implemented in Imago::ECS::SparseSet< T >.

◆ remove()

virtual void Imago::ECS::SparseSetBase::remove ( Entity e)
pure virtual

removes an Entity's component from this pool, if it is currently present

Parameters
ethe Entity to remove

Implemented in Imago::ECS::SparseSet< T >.

◆ swap_entities()

virtual void Imago::ECS::SparseSetBase::swap_entities ( Entity e1,
Entity e2 )
pure virtual

Swaps e1 with e2 in _dense, _entities, and _sparse.

Parameters
e1First Entity to swap.
e2Second Entity to swap.

Implemented in Imago::ECS::SparseSet< T >.


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