1 #ifndef UTOPIA_CORE_ENTITY_HH
2 #define UTOPIA_CORE_ENTITY_HH
22 template<
typename EntityContainerType>
44 template<
typename StateType,
46 bool use_def_state_constr=
false,
63 template<
class EntityContainerType>
64 using CustomLinks = CustomLinkContainers<EntityContainerType>;
79 template<
typename Derived,
typename _Traits>
96 using State =
typename Traits::State;
102 using Tags =
typename Traits::Tags;
110 typename Traits::template CustomLinks<EntityContainer<Derived>>;
An entity is a slightly specialized state container.
Definition: entity.hh:83
CustomLinkContainers & custom_links()
Return reference to custom link containers.
Definition: entity.hh:139
typename Traits::Tags Tags
The tags associated with this entity.
Definition: entity.hh:102
const CustomLinkContainers & custom_links() const
Return const reference to custom link containers.
Definition: entity.hh:144
Entity(const IndexType id, const State initial_state)
Construct an entity.
Definition: entity.hh:123
typename Traits::State State
The type of the state of this entity.
Definition: entity.hh:96
_Traits Traits
The traits of this entity.
Definition: entity.hh:90
static constexpr Update mode
Whether this entity is updated synchronously.
Definition: entity.hh:99
CustomLinkContainers _custom_links
Container for storing the custom links of this entity.
Definition: entity.hh:118
const IndexType & id() const
Return const reference to entity ID.
Definition: entity.hh:134
typename Traits::template CustomLinks< EntityContainer< Derived > > CustomLinkContainers
A construct that has as members containers for custom-linked entities.
Definition: entity.hh:110
const IndexType _id
ID of this entity.
Definition: entity.hh:115
Container for states.
Definition: state.hh:37
Update
Update modes when applying rules.
Definition: state.hh:20
std::size_t IndexType
Type for indices, i.e. values used for container indexing, agent IDs, ...
Definition: types.hh:40
The entity traits struct gathers types to be used for specializing an entity.
Definition: entity.hh:49
CustomLinkContainers< EntityContainerType > CustomLinks
Template template parameter to specify type of custom links.
Definition: entity.hh:64
EntityTags Tags
Custom entity tags.
Definition: entity.hh:60
static constexpr bool use_default_state_constructor
Whether to use the default constructor for constructing a entity state.
Definition: entity.hh:57
static constexpr Update mode
Whether the entitys should be synchronously updated.
Definition: entity.hh:54
StateType State
Type of the entitys' state container.
Definition: entity.hh:51
Default struct for EntityTraits; use this one if there are no custom links.
Definition: entity.hh:23