ecs
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ecs::Registry Class Reference

define the Registry class More...

#include <Registry.hpp>

Public Member Functions

Entity createEntity ()
 handling entities (define in Registry.cpp)
 
Entity entityFromIndex (std::size_t idx)
 Create a Entity object from an index.
 
void killEntity (Entity const &e)
 Kill the given entity.
 
template<typename Component >
SparseArray< Component > & registerComponent ()
 handling components (define in Registry_impl.hpp)
 
template<class ... Components>
void registerComponents ()
 register a list of components
 
template<IsTuple Tuple>
void registerComponentsByExtraction ()
 register every components by extraction from a tuple
 
template<class Component >
SparseArray< Component > & getComponents ()
 get components of a given type
 
template<class Component >
const SparseArray< Component > & getComponents () const
 get immutable components of a given type
 
template<typename... Component, typename = std::enable_if_t<(sizeof...(Component) != 0)>>
void addComponent (Entity const &to, Component &&...c)
 
template<typename Component , typename ... Params>
void emplaceComponent (Entity const &to, Params &&... p)
 emplace a component to the given entity
 
template<typename... Component, typename = std::enable_if<(sizeof...(Component) != 0)>>
void removeComponent (Entity const &from)
 remove a component from the given entity
 
template<SystemImplementation System>
void addSystem (System &s)
 handling systems
 
template<SystemImplementation System>
void addSystem (System &&s)
 add rvalue
 
template<SystemImplementation... System, typename = std::enable_if<(sizeof...(System) != 0)>>
void addSystem (System &&... s)
 add a system to the registry
 
template<SystemImplementation System, typename ... Params>
void emplaceSystem (Params &&... params)
 add a system to the registry
 
template<SystemImplementation ... System, typename = std::enable_if<(sizeof...(System) != 0)>>
void removeSystem ()
 remove a system from the registry
 
template<SystemImplementation ... System, typename = std::enable_if<(sizeof...(System) != 0)>>
void callSystem ()
 call a system
 
template<SystemImplementation System, typename... Args>
void emplaceSystem (Args &&... args)
 

Detailed Description

define the Registry class

Examples
TestEcs.cpp.

Member Function Documentation

◆ addComponent()

template<typename... Component, typename >
void ecs::Registry::addComponent ( Entity const to,
Component &&...  c 
)
Template Parameters
adda component to the given entity
Parameters
to
c
Returns
SparseArray<Component>::reference_type

◆ addSystem() [1/3]

template<SystemImplementation... System, typename >
void ecs::Registry::addSystem ( System &&...  s)

add a system to the registry

Template Parameters
...T
controlvariadic list isn't empty
Parameters
s

◆ addSystem() [2/3]

template<SystemImplementation System>
void ecs::Registry::addSystem ( System &&  s)

add rvalue

Template Parameters
moveconstructor
Parameters
s

◆ addSystem() [3/3]

template<SystemImplementation System>
void ecs::Registry::addSystem ( System s)

handling systems

add lvalue

Template Parameters
System
Parameters
s
Examples
TestEcs.cpp.

◆ callSystem()

template<SystemImplementation ... System, typename >
void ecs::Registry::callSystem ( )

call a system

Template Parameters
T
Examples
TestEcs.cpp.

◆ createEntity()

Entity Registry::createEntity ( )

handling entities (define in Registry.cpp)

handling entities

Create a Entity object

Returns
Entity
Examples
TestEcs.cpp.

◆ emplaceComponent()

template<typename Component , typename ... Params>
void ecs::Registry::emplaceComponent ( Entity const to,
Params &&...  p 
)

emplace a component to the given entity

Template Parameters
Component
Params
Parameters
to
p
Returns
SparseArray <Component>::reference_type

◆ emplaceSystem() [1/2]

template<SystemImplementation System, typename... Args>
void ecs::Registry::emplaceSystem ( Args &&...  args)

◆ emplaceSystem() [2/2]

template<SystemImplementation System, typename ... Params>
void ecs::Registry::emplaceSystem ( Params &&...  params)

add a system to the registry

Template Parameters
T
Parameters
existingSystem
Returns
size_t

◆ entityFromIndex()

Entity Registry::entityFromIndex ( std::size_t  idx)

Create a Entity object from an index.

Parameters
idx
Returns
Entity

◆ getComponents() [1/2]

template<class Component >
SparseArray< Component > & ecs::Registry::getComponents ( )

get components of a given type

Template Parameters
Component
Returns
SparseArray<Component>&
Examples
TestEcs.cpp.

◆ getComponents() [2/2]

template<class Component >
const SparseArray< Component > & ecs::Registry::getComponents ( ) const

get immutable components of a given type

Template Parameters
Component
Returns
const SparseArray<Component>&

◆ killEntity()

void Registry::killEntity ( Entity const e)

Kill the given entity.

Parameters
e

◆ registerComponent()

template<class Component >
SparseArray< Component > & ecs::Registry::registerComponent ( )

handling components (define in Registry_impl.hpp)

register a component

Template Parameters
Component
Returns
SparseArray<Component>&

◆ registerComponents()

template<class ... Components>
void ecs::Registry::registerComponents ( )

register a list of components

Template Parameters
Components
Examples
TestEcs.cpp.

◆ registerComponentsByExtraction()

template<IsTuple Tuple>
void ecs::Registry::registerComponentsByExtraction ( )

register every components by extraction from a tuple

Template Parameters
Tuple
Examples
TestEcs.cpp.

◆ removeComponent()

template<typename ... Component, typename >
void ecs::Registry::removeComponent ( Entity const from)

remove a component from the given entity

Template Parameters
Component
Parameters
from

◆ removeSystem()

template<SystemImplementation ... System, typename >
void ecs::Registry::removeSystem ( )

remove a system from the registry

Template Parameters
T

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