Architecture Arcade
Architecture Commune Arcade
IEntity.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** Archi Arcade Promo 2026 Toulouse
4 ** File description:
5 ** Entity is the most little thing in the ECS (you can add component to it)
6 */
7 
8 #pragma once
9 
10 #include <cstddef>
11 #include <map>
12 #include <memory>
13 #include <string>
14 #include <vector>
15 #include "IComponent.hpp"
16 
17 namespace Arcade {
18  namespace ECS {
22  class IEntity {
23  public:
24  virtual ~IEntity() = default;
30  virtual std::string getId() const = 0;
36  virtual const std::map<CompType,
37  std::vector<std::shared_ptr<IComponent>>> &
38  getComponents() const = 0;
49  virtual const std::vector<std::shared_ptr<IComponent>> &
50  getComponents(CompType type) const = 0;
58  virtual IComponent &getComponents(const std::string &id) = 0;
64  virtual void addComponent(
65  std::shared_ptr<IComponent> component) = 0;
71  virtual void removeComponent(const std::string &id) = 0;
77  virtual void removeComponent(CompType type) = 0;
78  };
79  } // namespace ECS
80 } // namespace Arcade
Definition: ArcadeStruct.hpp:10
Definition: IComponent.hpp:39
The IEntity interface.
Definition: IEntity.hpp:22
virtual std::string getId() const =0
Get the entity id.
virtual ~IEntity()=default
virtual void addComponent(std::shared_ptr< IComponent > component)=0
Add a component.
virtual void removeComponent(const std::string &id)=0
Remove a component.
virtual IComponent & getComponents(const std::string &id)=0
Get component by its id.
virtual const std::vector< std::shared_ptr< IComponent > > & getComponents(CompType type) const =0
Get all components of type compType
virtual const std::map< CompType, std::vector< std::shared_ptr< IComponent > > > & getComponents() const =0
Get all components.
virtual void removeComponent(CompType type)=0
Remove all components of type CompType