Utopia 2
Framework for studying models of complex & adaptive systems.
|
An entity is a slightly specialized state container. More...
#include <entity.hh>
Public Types | |
using | Traits = _Traits |
The traits of this entity. | |
using | Self = Entity< Derived, Traits > |
The type of this entity. | |
using | State = typename Traits::State |
The type of the state of this entity. | |
using | Tags = typename Traits::Tags |
The tags associated with this entity. | |
using | CustomLinkContainers = typename Traits::template CustomLinks< EntityContainer< Derived > > |
A construct that has as members containers for custom-linked entities. | |
Public Member Functions | |
Entity (const IndexType id, const State initial_state) | |
Construct an entity. | |
const IndexType & | id () const |
Return const reference to entity ID. | |
CustomLinkContainers & | custom_links () |
Return reference to custom link containers. | |
const CustomLinkContainers & | custom_links () const |
Return const reference to custom link containers. | |
Static Public Attributes | |
static constexpr Update | mode = Traits::mode |
Whether this entity is updated synchronously. | |
Private Attributes | |
const IndexType | _id |
ID of this entity. | |
CustomLinkContainers | _custom_links |
Container for storing the custom links of this entity. | |
An entity is a slightly specialized state container.
It can be extended with the use of tags and can be associated with so-called "custom links". These specializations are carried into the entity by means of the EntityTraits struct. An entity is embedded into the EntityManager, where the discretization allows assigning a position in space to the entity. The entity itself does not need to know anything about that ...
Derived | The type of the derived class (for CRTP) |
_Traits | Valid EntityTraits, specializing this entity. |
using Utopia::Entity< Derived, _Traits >::CustomLinkContainers = typename Traits::template CustomLinks<EntityContainer<Derived> > |
A construct that has as members containers for custom-linked entities.
By templating this struct, it need not declare the type of the entities if they have the same traits as this entity. This makes creation of links to other entities of the same type easier.
using Utopia::Entity< Derived, _Traits >::State = typename Traits::State |
The type of the state of this entity.
using Utopia::Entity< Derived, _Traits >::Tags = typename Traits::Tags |
The tags associated with this entity.
using Utopia::Entity< Derived, _Traits >::Traits = _Traits |
The traits of this entity.
By exporting this, it is made possible to check for the specialization of the entity. For example, Utopia::is_cell_manager makes use of this export.
Construct an entity.
|
inline |
Return reference to custom link containers.
|
inline |
Return const reference to custom link containers.
|
inline |
Return const reference to entity ID.
|
private |
Container for storing the custom links of this entity.
|
private |
ID of this entity.
|
staticconstexpr |
Whether this entity is updated synchronously.