31#include <utility/logging/loggable.hpp>
32#include <utility/logging/default_logger.hpp>
34#include "guillaume/ecs/component.hpp"
35#include "guillaume/ecs/component_type_id.hpp"
78 protected utility::logging::Loggable<Entity,
79 utility::logging::DefaultLogger>
124 std::int32_t _layer {
127 std::weak_ptr<Entity> _parent;
155 template<InheritFromComponent... ComponentTypes>
205 std::int32_t
getLayer(
void)
const noexcept;
249 std::shared_ptr<Entity>
getParent(
void)
const noexcept;
257 template<
typename Type>
263#include "guillaume/ecs/entity.tpp"
An ecs::ComponentRegistry whose storages for the general-purpose components (geometry,...
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
virtual ~Entity(void)=default
Destroy the entity object.
std::bitset< 128 > Signature
A set of component types, one bit per type (bit position given by ComponentTypeId,...
std::vector< Identifier > releaseComponents(void)
Drop the entity's place in the tree and all its components.
Entity & setParent(std::shared_ptr< Entity > parent)
Attach the entity under another one, or detach it.
Entity::Signature getSignature(void) const noexcept
Get the set of component types the entity declares.
Entity(void)
Create an entity with a fresh identifier, an empty signature, no parent and no component.
static Signature getSignatureFromTypes(void)
Build the signature that has exactly the bits of the given component types.
Entity::Identifier getIdentifier(void) const noexcept
Get the identifier of the entity.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
std::int32_t getLayer(void) const noexcept
Get the depth of the entity in the tree.
std::shared_ptr< Entity > getParent(void) const noexcept
Get the parent entity.
void setSignature(void)
Replace the signature by the one made of the given component types.
void attachHierarchy(ComponentRegistry &componentRegistry)
Give the entity a components::Hierarchy in a registry and add that component to its signature.
static constexpr Identifier InvalidIdentifier
"No entity": never the identifier of a real entity
Constrains a template parameter to a type derived from Component (or Component itself).
Constrains a template parameter to a type derived from Entity (or Entity itself).
The entity-component-system core, independent of any widget.