fpmas 1.6
Public Member Functions | List of all members
fpmas::model::Neighbor< AgentType > Class Template Reference

#include <model.h>

Public Member Functions

 Neighbor ()
 
 Neighbor (AgentPtr *agent)
 
 Neighbor (AgentPtr *agent, AgentEdge *edge)
 
 operator AgentType * () const
 
AgentType * operator-> () const
 
AgentType & operator* () const
 
AgentEdge * edge () const
 
AgentType * agent () const
 

Detailed Description

template<typename AgentType>
class fpmas::model::Neighbor< AgentType >

Helper class to represent an Agent as the neighbor of an other.

A Neighbor can be used through pointer like accesses, and the input Agent is automatically downcast to AgentType.

Template Parameters
AgentTypeType of the input agent

Constructor & Destructor Documentation

◆ Neighbor() [1/3]

template<typename AgentType >
fpmas::model::Neighbor< AgentType >::Neighbor ( )
inline

Initializes a null Neighbor.

The Neighbor can eventually be assigned later with a non-null Neighbor.

Example
Neighbor neighbor;
neighbor = agent->outNeighbors<...>().random();
AgentType * agent() const
Definition: model.h:124
Neighbor()
Definition: model.h:62

◆ Neighbor() [2/3]

template<typename AgentType >
fpmas::model::Neighbor< AgentType >::Neighbor ( AgentPtr agent)
inline
Deprecated:

Neighbor constructor.

Parameters
agentpointer to a generic AgentPtr

◆ Neighbor() [3/3]

template<typename AgentType >
fpmas::model::Neighbor< AgentType >::Neighbor ( AgentPtr agent,
AgentEdge *  edge 
)
inline

Neighbor constructor.

Parameters
agentpointer to a generic AgentPtr
edgeedge with wich the neighbor is linked to agent

Member Function Documentation

◆ operator AgentType *()

template<typename AgentType >
fpmas::model::Neighbor< AgentType >::operator AgentType * ( ) const
inline

Implicit conversion operator to AgentType*.

◆ operator->()

template<typename AgentType >
AgentType * fpmas::model::Neighbor< AgentType >::operator-> ( ) const
inline

Member of pointer access operator.

Returns
pointer to neighbor agent

◆ operator*()

template<typename AgentType >
AgentType & fpmas::model::Neighbor< AgentType >::operator* ( ) const
inline

Indirection operator.

Returns
reference to neighbor agent

◆ edge()

template<typename AgentType >
AgentEdge * fpmas::model::Neighbor< AgentType >::edge ( ) const
inline

Returns the edge with which this neighbor is linked to agent.

Returns
neighbor edge

◆ agent()

template<typename AgentType >
AgentType * fpmas::model::Neighbor< AgentType >::agent ( ) const
inline

Returns a pointer to the internal Agent, or a nullptr if the Neighbor is null.

Returns
pointer to internal agent

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