fpmas 1.6
Public Member Functions | Protected Attributes | List of all members
fpmas::model::CellBase< CellInterface, CellType, TypeIdBase > Class Template Reference

#include <spatial_model.h>

Inheritance diagram for fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >:
Collaboration graph
[legend]

Public Member Functions

 CellBase ()=default
 
 CellBase (const CellBase &)=default
 
CellBaseoperator= (const CellBase &)=default
 
 CellBase (CellBase &&)=default
 
CellBase< CellInterface, CellType, TypeIdBase > & operator= (CellBase< CellInterface, CellType, TypeIdBase > &&)
 
std::vector< api::model::Cell * > successors () override
 
void handleNewLocation () override
 
void handleMove () override
 
void handlePerceive () override
 
void updatePerceptions (api::model::AgentGroup &group) override
 
void init () override
 
- Public Member Functions inherited from fpmas::model::detail::AgentBase< CellInterface, CellType, CellType >
 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
 

Protected Attributes

std::set< DistributedIdno_move_flags
 
std::set< DistributedIdmove_flags
 
std::set< DistributedIdperception_flags
 

Additional Inherited Members

- Public Types inherited from fpmas::model::detail::AgentBase< CellInterface, CellType, CellType >
typedef CellType FinalAgentType
 
- Static Public Attributes inherited from fpmas::model::detail::AgentBase< CellInterface, CellType, CellType >
static const api::model::TypeId TYPE_ID
 

Detailed Description

template<typename CellInterface, typename CellType, typename TypeIdBase = CellType>
class fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >

api::model::Cell implementation.

The CellInterface template parameter specifies the API actually implemented by this class. It can be api::model::Cell, or any other api that extends the api::model::Cell interface (e.g. api::model::GridCell).

See fpmas::model::detail::AgentBase for more details about the implementation scheme.

See also
Cell
Template Parameters
CellInterfaceCell interface implemented by this CellBase
CellTypefinal CellBase type (i.e. most derived class from this CellBase)
TypeIdBasetype used to define the type id of the current AgentBase implementation.

Constructor & Destructor Documentation

◆ CellBase() [1/3]

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::CellBase ( )
default

Auto generated default constructor.

◆ CellBase() [2/3]

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::CellBase ( const CellBase< CellInterface, CellType, TypeIdBase > &  )
default

Auto generated copy constructor.

If CellType does not define any custom copy constructor , the CellType copy constructor copies all CellType members and all base classes (including this CellBase) members using their copy constructors.

If a custom CellType copy constructor is defined, this CellBase copy constructor must be called explictly to ensure required members are properly copied.

See also
https://en.cppreference.com/w/cpp/language/copy_constructor

◆ CellBase() [3/3]

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::CellBase ( CellBase< CellInterface, CellType, TypeIdBase > &&  )
default

Auto generated move constructor.

If CellType does not define any custom move constructor , the AgentType move constructor moves all internal CellType members and all base classes (including this CellBase) members using their move constructors.

If a custom CellType move constructor is defined, this CellBase move constructor must be called explictly to ensure required members are properly moved.

See also
https://en.cppreference.com/w/cpp/language/move_constructor

Member Function Documentation

◆ operator=() [1/2]

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
CellBase & fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::operator= ( const CellBase< CellInterface, CellType, TypeIdBase > &  )
default

Auto generated copy assignment operator.

If CellType does not define any custom copy assignment operator, the CellType copy assignment operator copies assign all CellType members and all base classes (including this CellBase) members.

If a custom CellType copy assignment operator is defined, this CellBase copy assignment operator must be called explictly to ensure required members are properly copied.

See also
https://en.cppreference.com/w/cpp/language/copy_assignment

◆ operator=() [2/2]

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
CellBase< CellInterface, CellType, TypeIdBase > & fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::operator= ( CellBase< CellInterface, CellType, TypeIdBase > &&  )
inline

Move assignment operator.

Internal bufferes are preserved, i.e. they are not moved from other to this.

Since the current implementation does not do anything, there is no requirement to explicitly call this move constructor if a custom CellBase move constructor is defined.

◆ successors()

template<typename CellInterface , typename CellType , typename TypeIdBase >
std::vector< api::model::Cell * > fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::successors
override

Returns successors of this Cell.

Successors are targets of outgoing edges from this Cell on the CELL_SUCCESSOR layer.

This method is assumed to be called on a LOCAL Cell. The returned list might be incomplete otherwise.

Returns
successors of this Cell

Implements fpmas::api::model::Cell

◆ handleNewLocation()

template<typename CellInterface , typename CellType , typename TypeIdBase >
void fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::handleNewLocation
override

Handles links on the NEW_LOCATION layer.

NEW_LOCATION links are replaced by LOCATION links, and the "range growing" algorithm is initialized, linking each NEW_LOCATION edges' sources to this cell's successors on the NEW_MOVE and NEW_PERCEIVE layers.

Implements fpmas::api::model::Cell

◆ handleMove()

template<typename CellInterface , typename CellType , typename TypeIdBase >
void fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::handleMove
override

Handles links on the MOVE layer.

Expands the current mobility range of MOVE edges' sources, if they have not been handled yet by this Cell. Expansion is performed linking each source to this cell's successors on the NEW_MOVE layer.

Implements fpmas::api::model::Cell

◆ handlePerceive()

template<typename CellInterface , typename CellType , typename TypeIdBase >
void fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::handlePerceive
override

Handles links on the PERCEIVE layer.

Expands the current perception range of PERCEIVE edges' sources, if they have not been handled yet by this Cell. Expansion is performed linking each source to this cell's successors on the NEW_PERCEIVE layer.

Implements fpmas::api::model::Cell

◆ updatePerceptions()

template<typename CellInterface , typename CellType , typename TypeIdBase >
void fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::updatePerceptions ( api::model::AgentGroup group)
override

Updates the perceptions of agents "perceiving" this Cell.

More precisely, each agent connected to this Cell on the PERCEIVE layer is linked to all agents located in this Cell, (i.e. connected on the LOCATION layer) on the PERCEPTION layer.

Implements fpmas::api::model::Cell

◆ init()

template<typename CellInterface , typename CellType , typename TypeIdBase >
void fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::init
override

Implementation free initialization method, called on each Cell when the DistributedMoveAlgorithm is run, before any other behavior is executed.

Implements fpmas::api::model::Cell

Member Data Documentation

◆ no_move_flags

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
std::set<DistributedId> fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::no_move_flags
protected

A local set of ids of agents that have not moved since the last DistributedMoveAlgorithm execution.

internal use only

◆ move_flags

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
std::set<DistributedId> fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::move_flags
protected

A local set of ids of agents that have explored the current cell on the MOVE layer during the current DistributedMoveAlgorithm execution.

internal use only

◆ perception_flags

template<typename CellInterface , typename CellType , typename TypeIdBase = CellType>
std::set<DistributedId> fpmas::model::CellBase< CellInterface, CellType, TypeIdBase >::perception_flags
protected

A local set of ids of agents that have explored the current cell on the PERCEIVE layer during the current DistributedMoveAlgorithm execution.

internal use only


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