Utopia  2
Framework for studying models of complex & adaptive systems.
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > > Class Template Reference

Agent specialization for asynchronous update. More...

#include <agent.hh>

Inheritance diagram for Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >:
Inheritance graph
[legend]
Collaboration diagram for Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >:
Collaboration graph
[legend]

Public Types

using Self = Agent< Traits, Space >
 The type of this agent. More...
 
using State = typename Traits::State
 The type of the state. More...
 
using Position = typename Space::SpaceVec
 The type of the position vector. More...
 
- Public Types inherited from Utopia::Entity< Agent< Traits, Space >, Traits >
using Traits = Traits
 The traits of this entity. More...
 
using Self = Entity< Agent< Traits, Space >, 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< Agent< Traits, Space > > >
 A construct that has as members containers for custom-linked entities. More...
 

Public Member Functions

 Agent (const IndexType id, const State initial_state, const Position &initial_pos)
 Construct an agent. More...
 
const Positionposition () const
 Return a const reference of the current position of the agent. More...
 
- Public Member Functions inherited from Utopia::Entity< Agent< Traits, Space >, Traits >
 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...
 

Protected Member Functions

void set_pos (const Position &pos)
 Set the position of the agent. More...
 

Private Attributes

Position _pos
 The position of the agent. More...
 

Friends

template<class T , class M >
class AgentManager
 Make the agent manager a (template) friend of this class. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Utopia::Entity< Agent< Traits, Space >, Traits >
static constexpr Update mode
 Whether this entity is updated synchronously. More...
 

Detailed Description

template<typename Traits, typename Space>
class Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >

Agent specialization for asynchronous update.

Member Typedef Documentation

◆ Position

template<typename Traits , typename Space >
using Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::Position = typename Space::SpaceVec

The type of the position vector.

◆ Self

template<typename Traits , typename Space >
using Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::Self = Agent<Traits, Space>

The type of this agent.

◆ State

template<typename Traits , typename Space >
using Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::State = typename Traits::State

The type of the state.

Constructor & Destructor Documentation

◆ Agent()

template<typename Traits , typename Space >
Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::Agent ( const IndexType  id,
const State  initial_state,
const Position initial_pos 
)
inline

Construct an agent.

Parameters
idThe id of this agent, ideally unique
initial_stateThe initial state
initial_posThe initial position

Member Function Documentation

◆ position()

template<typename Traits , typename Space >
const Position& Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::position ( ) const
inline

Return a const reference of the current position of the agent.

◆ set_pos()

template<typename Traits , typename Space >
void Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::set_pos ( const Position pos)
inlineprotected

Set the position of the agent.

This function allows befriended classes to set the position of this agent.

Note
No check is carried out whether the new position is valid; this needs to happen in the construct that is aware of the space the agent resides in, i.e.: Utopia::AgentManager.
Parameters
posThe new position of the agent

Friends And Related Function Documentation

◆ AgentManager

template<typename Traits , typename Space >
template<class T , class M >
friend class AgentManager
friend

Make the agent manager a (template) friend of this class.

Member Data Documentation

◆ _pos

template<typename Traits , typename Space >
Position Utopia::Agent< Traits, Space, std::enable_if_t< Traits::mode !=Update::sync > >::_pos
private

The position of the agent.


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