Architecture Arcade
Architecture Commune Arcade
Public Member Functions | List of all members
Arcade::ECS::IEntity Class Referenceabstract

The IEntity interface. More...

#include <IEntity.hpp>

Collaboration diagram for Arcade::ECS::IEntity:
Collaboration graph

Public Member Functions

virtual ~IEntity ()=default
 
virtual std::string getId () const =0
 Get the entity id. More...
 
virtual const std::map< CompType, std::vector< std::shared_ptr< IComponent > > > & getComponents () const =0
 Get all components. More...
 
virtual const std::vector< std::shared_ptr< IComponent > > & getComponents (CompType type) const =0
 Get all components of type compType More...
 
virtual IComponentgetComponents (const std::string &id)=0
 Get component by its id. More...
 
virtual void addComponent (std::shared_ptr< IComponent > component)=0
 Add a component. More...
 
virtual void removeComponent (const std::string &id)=0
 Remove a component. More...
 
virtual void removeComponent (CompType type)=0
 Remove all components of type CompType More...
 

Detailed Description

The IEntity interface.

Constructor & Destructor Documentation

◆ ~IEntity()

virtual Arcade::ECS::IEntity::~IEntity ( )
virtualdefault

Member Function Documentation

◆ addComponent()

virtual void Arcade::ECS::IEntity::addComponent ( std::shared_ptr< IComponent component)
pure virtual

Add a component.

Parameters
componentThe component to add

◆ getComponents() [1/3]

virtual const std::map<CompType, std::vector<std::shared_ptr<IComponent> > >& Arcade::ECS::IEntity::getComponents ( ) const
pure virtual

Get all components.

Returns
The list of components

◆ getComponents() [2/3]

virtual const std::vector<std::shared_ptr<IComponent> >& Arcade::ECS::IEntity::getComponents ( CompType  type) const
pure virtual

Get all components of type compType

Parameters
typeThe type of component to get

!!!ATTENTION!!!: You need to use .at() in order to manipulate your map or vector because of const

Returns
The list of components filtered

◆ getComponents() [3/3]

virtual IComponent& Arcade::ECS::IEntity::getComponents ( const std::string &  id)
pure virtual

Get component by its id.

Parameters
idThe id of the component to get
Returns
The component (if it doesn't exists: throw)

◆ getId()

virtual std::string Arcade::ECS::IEntity::getId ( ) const
pure virtual

Get the entity id.

Returns
The entity id

◆ removeComponent() [1/2]

virtual void Arcade::ECS::IEntity::removeComponent ( CompType  type)
pure virtual

Remove all components of type CompType

Parameters
typeThe type of component to remove

◆ removeComponent() [2/2]

virtual void Arcade::ECS::IEntity::removeComponent ( const std::string &  id)
pure virtual

Remove a component.

Parameters
std::stringThe component id to remove

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