3#include <unordered_map>
6#include <libecs-cpp/json.hpp>
30 virtual nlohmann::json
Export()
const = 0;
Base class for the data attached to an entity.
Definition Component.hpp:19
Component()=default
Creates a component with an empty Type and EntityHandle.
virtual ~Component()=default
Destroys the component.
std::string Type
The type name the component is stored and looked up under, for example "PositionComponent".
Definition Component.hpp:34
Component(const nlohmann::json &)
Creates a component from a configuration, which the base class does not read.
Definition Component.hpp:27
std::string EntityHandle
The handle of the entity the component is attached to.
Definition Component.hpp:37
virtual nlohmann::json Export() const =0
Describes the component as JSON; every subclass implements it.
std::unordered_map< std::string, std::shared_ptr< ecs::Component > > EntityComponentList
The components of one type, by entity handle.
Definition Component.hpp:43
std::unordered_map< std::string, ecs::EntityComponentList > TypeEntityComponentList
The components of a container, by type name and then by entity handle.
Definition Component.hpp:48