ecs::Registry

More...

#include <Registry.hpp>

Public Functions

Name

template <class Component > SparseArrayarrow-up-right< Component > &

template <class Component > SparseArrayarrow-up-right< Component > &

template <class Component > SparseArrayarrow-up-right< Component > const &

template <typename Component > SparseArrayarrow-up-right< Component >::referenceType

template <typename Component ,typename... Params> SparseArrayarrow-up-right< Component >::referenceType

template <typename Component > void

Detailed Description

class ecs::Registry;

[This is the core of the ECS]

This class contains many feature as follows :

(Feel free to check the Entity.hpparrow-up-right to learn more about the subject)

  • EntitiesBin Manager, Registryarrow-up-right is saving killed entity in the bin that which can be recovered instead of creating another one

Public Functions Documentation

function Registry

function registerComponent

Template Parameters:

  • Component The type of components you want to register

Return: The SparseArrayarrow-up-right of components you just registered

This function is used to register a new component in the private member _unordered_map

function getComponents

Template Parameters:

  • Component The type of components you want to get

Return: The SparseArrayarrow-up-right of components you asked

This function is used to get all components already registered in the Registryarrow-up-right class following the given component template

function getComponents

Template Parameters:

  • Component The type of components you want to get

Return: The const SparseArrayarrow-up-right of components you asked

This function is used to get all components already registered in the Registryarrow-up-right class following the given component template as const

function spawn_entity

Return: The entity just created (id)

This function is used to create a new entity if it doesn't exists in the _entitiesBin, otherwise it recover it from the bin

function entityFromIndex

Parameters:

  • idx The index of the entity whose id is desired

Return: The id of the Entityarrow-up-right if it exists, ecs::npos otherwise

This function is used to get the id of the Entityarrow-up-right following the give index

function killEntity

Parameters:

This is used to delete the given Entityarrow-up-right (id) For optimisation purposes, Registryarrow-up-right class push it in the _entitiesBin

function addComponent

Parameters:

Template Parameters:

  • Component The type of component want to be added

Return: the SparseArray reference of the component

This function is used to add a component into the Entityarrow-up-right given as parameter. In the same time, the erase function of this component is pushed into the _eraseFunctions vector, in this case we can simply delete a component without needing type of it

function emplaceComponent

Parameters:

  • to The Entityarrow-up-right in which you want to emplace component

  • p Parameters of the component you want to emplace

Template Parameters:

  • Component The type of component you want to emplace

  • Params The parameters' type of the component you want to emplace

Return: the SparseArray reference of the component

This function is used to emplace a component with given parameters of this component

function removeComponent

Parameters:

Template Parameters:

  • Component The type of the component you want to remove

This function is used to remove a component into an Entityarrow-up-right given as parameter


Updated on 2022-11-13 at 17:21:37 +0100

Last updated