Utopia  2
Framework for studying models of complex & adaptive systems.
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. More...
 
using Self = Entity< Derived, Traits >
 The type of this entity. More...
 
using State = typename Traits::State
 The type of the state of this entity. More...
 
using Tags = typename Traits::Tags
 The tags associated with this entity. More...
 
using CustomLinkContainers = typename Traits::template CustomLinks< EntityContainer< Derived > >
 A construct that has as members containers for custom-linked entities. More...
 

Public Member Functions

 Entity (const IndexType id, const State initial_state)
 Construct an entity. More...
 
const IndexTypeid () const
 Return const reference to entity ID. More...
 
CustomLinkContainerscustom_links ()
 Return reference to custom link containers. More...
 
const CustomLinkContainerscustom_links () const
 Return const reference to custom link containers. More...
 

Static Public Attributes

static constexpr Update mode = Traits::mode
 Whether this entity is updated synchronously. More...
 

Private Attributes

const IndexType _id
 ID of this entity. More...
 
CustomLinkContainers _custom_links
 Container for storing the custom links of this entity. More...
 

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.

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.

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

◆ id()

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

Return const reference to entity ID.

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: