fpmas 1.6
Protected Member Functions | List of all members
fpmas::model::SpatialAgent< AgentType, CellType, Derived > Class Template Reference

#include <spatial_model.h>

Inheritance diagram for fpmas::model::SpatialAgent< AgentType, CellType, Derived >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::SpatialAgent< AgentType, CellType, Derived >:
Collaboration graph
[legend]

Protected Member Functions

void moveTo (CellType *cell) override
 
- Protected Member Functions inherited from fpmas::model::SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType >
void updateLocation (api::model::Cell *cell)
 
void handleNewMove () override
 
void handleNewPerceive () override
 
void moveTo (DistributedId id) override
 
Neighbors< api::model::CellmobilityField () const
 
Neighbors< NeighborType > perceptions () const
 
- Protected Member Functions inherited from fpmas::api::model::SpatialAgent< api::model::Cell >
virtual void moveTo (DistributedId id)=0
 
virtual void moveTo (Cell *cell)=0
 

Additional Inherited Members

- Public Types inherited from fpmas::model::SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType >
typedef SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType > JsonBase
 
- Public Types inherited from fpmas::model::detail::AgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType > >
typedef AgentType FinalAgentType
 
- Public Types inherited from fpmas::api::model::SpatialAgent< api::model::Cell >
typedef api::model::Cell Cell
 
- Public Member Functions inherited from fpmas::model::SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType >
void initLocation (api::model::Cell *cell) override
 
DistributedId locationId () const override
 
api::model::CelllocationCell () const override
 
- Public Member Functions inherited from fpmas::model::detail::AgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType > >
 AgentBase ()=default
 
 AgentBase (const AgentBase &agent)=default
 
 AgentBase (AgentBase &&)=default
 
AgentBaseoperator= (const AgentBase &agent)=default
 
AgentBaseoperator= (AgentBase &&)
 
GroupId groupId () const override
 
std::vector< GroupId > groupIds () const override
 
void setGroupId (api::model::GroupId id) override
 
void addGroupId (api::model::GroupId id) override
 
void removeGroupId (api::model::GroupId id) override
 
api::model::AgentGroupgroup () override
 
const api::model::AgentGroupgroup () const override
 
std::vector< const api::model::AgentGroup * > groups () const override
 
std::vector< api::model::AgentGroup * > groups () override
 
void setGroup (api::model::AgentGroup *group) override
 
void addGroup (api::model::AgentGroup *group) override
 
void removeGroup (api::model::AgentGroup *group) override
 
void setGroupPos (api::model::GroupId gid, std::list< api::model::Agent * >::iterator pos) override
 
std::list< api::model::Agent * >::iterator getGroupPos (api::model::GroupId gid) const override
 
api::model::TypeId typeId () const override
 
api::model::Agentcopy () const override
 
void copyAssign (api::model::Agent *agent) override
 
void moveAssign (api::model::Agent *agent) override
 
api::model::AgentNodenode () override
 
const api::model::AgentNodenode () const override
 
void setNode (api::model::AgentNode *node) override
 
api::model::Modelmodel () override
 
const api::model::Modelmodel () const override
 
void setModel (api::model::Model *model) override
 
api::model::AgentTasktask () override
 
const api::model::AgentTasktask () const override
 
api::model::AgentTasktask (api::model::GroupId id) override
 
const api::model::AgentTasktask (api::model::GroupId id) const override
 
void setTask (api::model::AgentTask *task) override
 
void setTask (api::model::GroupId id, api::model::AgentTask *task) override
 
const std::unordered_map< api::model::GroupId, api::model::AgentTask * > & tasks () override
 
virtual void act () override
 
Neighbors< NeighborAgentType > outNeighbors () const
 
Neighbors< NeighborAgentType > outNeighbors (api::graph::LayerId layer) const
 
Neighbors< NeighborAgentType > inNeighbors () const
 
Neighbors< NeighborAgentType > inNeighbors (api::graph::LayerId layer) const
 
- Public Member Functions inherited from fpmas::api::model::SpatialAgent< api::model::Cell >
virtual DistributedId locationId () const=0
 
virtual api::model::CelllocationCell () const=0
 
virtual void initLocation (Cell *cell)=0
 
virtual const Range< api::model::Cell > & mobilityRange () const=0
 
virtual const Range< api::model::Cell > & perceptionRange () const=0
 
- Public Member Functions inherited from fpmas::api::model::Agent
virtual GroupId groupId () const =0
 
virtual std::vector< GroupIdgroupIds () const =0
 
virtual void setGroupId (GroupId id)=0
 
virtual void addGroupId (GroupId id)=0
 
virtual void removeGroupId (GroupId id)=0
 
virtual AgentGroupgroup ()=0
 
virtual const AgentGroupgroup () const =0
 
virtual std::vector< AgentGroup * > groups ()=0
 
virtual std::vector< const AgentGroup * > groups () const =0
 
virtual void setGroup (AgentGroup *group)=0
 
virtual void addGroup (AgentGroup *group)=0
 
virtual void removeGroup (AgentGroup *group)=0
 
virtual void setGroupPos (api::model::GroupId gid, std::list< Agent * >::iterator pos)=0
 
virtual std::list< Agent * >::iterator getGroupPos (api::model::GroupId gid) const =0
 
virtual TypeId typeId () const =0
 
virtual Agentcopy () const =0
 
virtual void copyAssign (Agent *agent)=0
 
virtual void moveAssign (Agent *agent)=0
 
virtual AgentNodenode ()=0
 
virtual const AgentNodenode () const =0
 
virtual void setNode (AgentNode *node)=0
 
virtual Modelmodel ()=0
 
virtual const Modelmodel () const =0
 
virtual void setModel (Model *model)=0
 
virtual AgentTasktask ()=0
 
virtual const AgentTasktask () const =0
 
virtual void setTask (AgentTask *task)=0
 
virtual AgentTasktask (GroupId id)=0
 
virtual const AgentTasktask (GroupId id) const =0
 
virtual void setTask (GroupId id, AgentTask *task)=0
 
virtual const std::unordered_map< GroupId, AgentTask * > & tasks ()=0
 
virtual void act ()=0
 
virtual void handleNewMove ()=0
 
virtual void handleNewPerceive ()=0
 
- Static Public Attributes inherited from fpmas::model::detail::AgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, SpatialAgentBase< api::model::SpatialAgent< api::model::Cell >, AgentType, api::model::Cell, AgentType > >
static const api::model::TypeId TYPE_ID
 

Detailed Description

template<typename AgentType, typename CellType = api::model::Cell, typename Derived = AgentType>
class fpmas::model::SpatialAgent< AgentType, CellType, Derived >

SpatialAgent that can be used in an arbitrary graph environment.

Template Parameters
AgentTypefinal SpatialAgent type (i.e. most derived class from this SpatialAgent)
CellTypetype of cells on which the agent moves
Deriveddirect derived class, or at least the next class in the serialization chain

Member Function Documentation

◆ moveTo()

template<typename AgentType , typename CellType = api::model::Cell, typename Derived = AgentType>
void fpmas::model::SpatialAgent< AgentType, CellType, Derived >::moveTo ( CellType *  cell)
inlineoverrideprotected

Moves to the input Cell.

The input Cell is not required to be contained in the current mobility field of this SpatialAgent, what allows:

  1. To initialize the location of this SpatialAgent (since in this case, the mobility field is still empty)
  2. A SpatialAgent to move an other DISTANT SpatialAgent.

The execution of a DistributedMoveAlgorithm is required to commit the operation and update mobility fields and perceptions. However, this can be handled automatically on specific AgentGroups: see SpatialModel::buildMoveGroup().

More precisely, the current location, if defined, is unlinked, and so does the mobility field and perceptions, and a link from this SpatialAgent to cell is created on the NEW_LOCATION layer. In consequence, the behavior of locationCell() is undefined until a DistributedMoveAlgorithm is executed.

Notice that performing an other moveTo() operation before the previous is committed produces an undefined behavior.

Parameters
cellcell to which this SpatialAgent should move.

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