Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Utopia::Entity< Derived, _Traits > Class Template Reference

An entity is a slightly specialized state container. More...

#include <entity.hh>

Inheritance diagram for Utopia::Entity< Derived, _Traits >:
Inheritance graph
[legend]
Collaboration diagram for Utopia::Entity< Derived, _Traits >:
Collaboration graph
[legend]

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 IndexTypeid () const
 Return const reference to entity ID.
 
CustomLinkContainerscustom_links ()
 Return reference to custom link containers.
 
const CustomLinkContainerscustom_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.
 

Detailed Description

template<typename Derived, typename _Traits>
class Utopia::Entity< Derived, _Traits >

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 ...

Template Parameters
DerivedThe type of the derived class (for CRTP)
_TraitsValid EntityTraits, specializing this entity.

Member Typedef Documentation

◆ CustomLinkContainers

template<typename Derived , typename _Traits >
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.

◆ Self

template<typename Derived , typename _Traits >
using Utopia::Entity< Derived, _Traits >::Self = Entity<Derived, Traits>

The type of this entity.

◆ State

template<typename Derived , typename _Traits >
using Utopia::Entity< Derived, _Traits >::State = typename Traits::State

The type of the state of this entity.

◆ Tags

template<typename Derived , typename _Traits >
using Utopia::Entity< Derived, _Traits >::Tags = typename Traits::Tags

The tags associated with this entity.

◆ Traits

template<typename Derived , typename _Traits >
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.

Constructor & Destructor Documentation

◆ Entity()

template<typename Derived , typename _Traits >
Utopia::Entity< Derived, _Traits >::Entity ( const IndexType  id,
const State  initial_state 
)
inline

Construct an entity.

124 :
125 // Store arguments and initialize Tags via default constructor
127 Tags(),
128 _id(id),
129 // Initialize custom links empty, i.e. with its default constructor
131 {}
typename Traits::Tags Tags
The tags associated with this entity.
Definition entity.hh:102
CustomLinkContainers _custom_links
Container for storing the custom links of this entity.
Definition entity.hh:118
const IndexType _id
ID of this entity.
Definition entity.hh:115
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213

Member Function Documentation

◆ custom_links() [1/2]

template<typename Derived , typename _Traits >
CustomLinkContainers & Utopia::Entity< Derived, _Traits >::custom_links ( )
inline

Return reference to custom link containers.

139 {
140 return _custom_links;
141 }

◆ custom_links() [2/2]

template<typename Derived , typename _Traits >
const CustomLinkContainers & Utopia::Entity< Derived, _Traits >::custom_links ( ) const
inline

Return const reference to custom link containers.

144 {
145 return _custom_links;
146 }

◆ id()

template<typename Derived , typename _Traits >
const IndexType & Utopia::Entity< Derived, _Traits >::id ( ) const
inline

Return const reference to entity ID.

134 {
135 return _id;
136 }

Member Data Documentation

◆ _custom_links

template<typename Derived , typename _Traits >
CustomLinkContainers Utopia::Entity< Derived, _Traits >::_custom_links
private

Container for storing the custom links of this entity.

◆ _id

template<typename Derived , typename _Traits >
const IndexType Utopia::Entity< Derived, _Traits >::_id
private

ID of this entity.

◆ mode

template<typename Derived , typename _Traits >
constexpr Update Utopia::Entity< Derived, _Traits >::mode = Traits::mode
staticconstexpr

Whether this entity is updated synchronously.


The documentation for this class was generated from the following file: