R-TYPE
Public Member Functions | List of all members
ECS::ComponentManager Class Reference

#include <ComponentManager.hpp>

Public Member Functions

 ComponentManager ()=default
 
 ~ComponentManager ()=default
 
void addComponent (Entity e, ComponentType c, std::shared_ptr< IComp > comp)
 
std::shared_ptr< ICompgetComponent (Entity e, ComponentType c)
 
std::map< ComponentType, std::shared_ptr< IComp > > & getComponentList (Entity entity)
 
std::deque< Entity > & getEntityList (ComponentType type)
 

Constructor & Destructor Documentation

◆ ComponentManager()

ECS::ComponentManager::ComponentManager ( )
default

◆ ~ComponentManager()

ECS::ComponentManager::~ComponentManager ( )
default

Member Function Documentation

◆ addComponent()

void ECS::ComponentManager::addComponent ( ECS::Entity  e,
ECS::ComponentType  c,
std::shared_ptr< IComp comp 
)

It adds a component to an entity

Parameters
eThe entity to add the component to.
cThe component type

◆ getComponent()

std::shared_ptr< ECS::IComp > ECS::ComponentManager::getComponent ( ECS::Entity  e,
ECS::ComponentType  c 
)

It returns a reference to the component of type c of entity e

Returns
A reference to the component of type c of entity e.

◆ getComponentList()

std::map< ECS::ComponentType, std::shared_ptr< ECS::IComp > > & ECS::ComponentManager::getComponentList ( Entity  entity)

It returns a reference to the map of components for the given entity

Returns
A map of component types and components.

◆ getEntityList()

std::deque< ECS::Entity > & ECS::ComponentManager::getEntityList ( ComponentType  type)

It returns a reference to the deque of entities that have the specified component type

Returns
A deque of entities.

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