#ifndef CENTITY_HPP #define CENTITY_HPP #include #include #include "../../Utils/JsonParser/CSerializable.hpp" #include "EntityComponentManager.hpp" namespace CosmicCore { class CScene; class CEntity : public CSerializable { private: /** * @brief A pointer to the scene containing the entity. */ CScene* m_scene; std::reference_wrapper m_registryReference; EntityId m_handle; public: /** * @brief CEntity's default constructor, disabled. */ CEntity() = delete; CEntity(std::reference_wrapper registry, EntityId handle, CScene* scene); CEntity(const CEntity& cop); CEntity& operator=(const CEntity& ent); /** * @brief CEntity's destructor. */ ~CEntity(void) = default; /** * @brief Getter to the parent entity. * @return a pointer to the parent entity m_parent. nullptr if there is not. */ //CEntity getParent(); template void addComponent(std::forward_list args) { m_registryReference().emplace(m_handle, *this, args); } template void addComponent() { m_registryReference().emplace(m_handle, *this); } EntityComponentManager& getRegistry(){return m_registryReference;}; const EntityComponentManager& getRegistry() const {return m_registryReference;}; EntityId getHandle(){return m_handle;}; /** * @brief Getter to the entity's scene. * @return The pointer m_scene. */ CScene* getScene(); /** * @brief Setter of the scene. * @param[in, out] e The scene in which the entity will be set. */ void setScene(CScene* s); EntityId operator*(){ return m_handle; } const EntityId operator*() const { return m_handle; } //TODO GET COMPONENT VECTOR OF SPECIFIC TYPE ? si utile nlohmann::json to_json(); }; } #endif