CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::SystemManager Class Referencefinal

The system manager is responsible for keeping track and dispatching updates to all attached systems. More...

#include <CeresEngine/Entity/SystemManager.hpp>

Public Member Functions

 SystemManager (EntityManager &entityManager)
 Creates a new system manager,.
 
 SystemManager (const SystemManager &)=delete
 
SystemManageroperator= (const SystemManager &)=delete
 
 ~SystemManager ()
 Destroys the system manager.
 
template<CSystemImplementation S, typename... Args>
Sadd (Args &&... args)
 Adds a new system of type S.
 
template<CSystem S>
void remove ()
 Removes a system of type S.
 
template<CSystem S>
Sget ()
 Gets a system of type S.
 
template<CSystem S>
bool has () noexcept
 Checks if the manager contains a system of type S.
 
void update (double time)
 Updates all systems.
 
template<CSystem S>
bool update (double time)
 Update a specific system of type S.
 

Public Attributes

EntityManagermEntityManager
 The entity manager to be used by systems.
 

Private Member Functions

void sort () noexcept
 Updates the system priority sorted list.
 

Private Attributes

Vector< UPtr< AbstractSystem > > mSystems
 A vector of all attached systems. Sorted by their ´SystemID`.
 
Vector< AbstractSystem * > mSortedSystems
 A vector of all attached systems.
 

Detailed Description

The system manager is responsible for keeping track and dispatching updates to all attached systems.

Constructor & Destructor Documentation

◆ SystemManager() [1/2]

CeresEngine::SystemManager::SystemManager ( EntityManager entityManager)
explicit

Creates a new system manager,.

Parameters
entityManagerThe entity manager to be used by systems

◆ SystemManager() [2/2]

CeresEngine::SystemManager::SystemManager ( const SystemManager )
delete

◆ ~SystemManager()

CeresEngine::SystemManager::~SystemManager ( )

Destroys the system manager.

Member Function Documentation

◆ add()

template<CSystemImplementation S, typename... Args>
S & CeresEngine::SystemManager::add ( Args &&...  args)

Adds a new system of type S.

Template Parameters
Sthe type of the system implementation
Argsthe system constructor argument types
Parameters
argsThe system constructor arguments
Returns
A reference to the created system

◆ get()

template<CSystem S>
S & CeresEngine::SystemManager::get ( )

Gets a system of type S.

Template Parameters
Sthe type of the system to be retrieved
Returns
A reference to the system of type S.

◆ has()

template<CSystem S>
bool CeresEngine::SystemManager::has ( )
noexcept

Checks if the manager contains a system of type S.

Template Parameters
Sthe type of the system to be checked
Returns
True if the system contains a system of type S, false otherwise.

◆ operator=()

SystemManager & CeresEngine::SystemManager::operator= ( const SystemManager )
delete

◆ remove()

template<CSystem S>
void CeresEngine::SystemManager::remove ( )

Removes a system of type S.

Template Parameters
Sthe type of the system to be removed

◆ sort()

void CeresEngine::SystemManager::sort ( )
privatenoexcept

Updates the system priority sorted list.

◆ update() [1/2]

void CeresEngine::SystemManager::update ( double  time)

Updates all systems.

Dispatches a update(double) call to all systems.

Parameters
timeThe time elapsed since the last update call.

◆ update() [2/2]

template<CSystem S>
bool CeresEngine::SystemManager::update ( double  time)

Update a specific system of type S.

Dispatches a update(double) call only to the system of type S. If no such system type is present, this method does nothing.

Template Parameters
Sthe type of the system to be updated
Parameters
timeThe time elapsed since the last update call.
Returns
True if the system was present and updated, false otherwise.

Member Data Documentation

◆ mEntityManager

EntityManager& CeresEngine::SystemManager::mEntityManager

The entity manager to be used by systems.

◆ mSortedSystems

Vector<AbstractSystem*> CeresEngine::SystemManager::mSortedSystems
private

A vector of all attached systems.

Already sorted according to their respective update order.

◆ mSystems

Vector<UPtr<AbstractSystem> > CeresEngine::SystemManager::mSystems
private

A vector of all attached systems. Sorted by their ´SystemID`.


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