RepastHPC  2.3.1
Public Member Functions | Friends | List of all members
repast::AgentId Class Reference

Agent identity information. More...

#include <AgentId.h>

Public Member Functions

 AgentId ()
 No-arg constructor necessary for serialization.
 
 AgentId (int id, int startProc, int agentType, int currentProc=-1)
 Creates an AgentId. More...
 
int id () const
 Gets the id component of this AgentId. More...
 
int startingRank () const
 Gets the starting rank component of this AgentId. More...
 
int agentType () const
 Gets the agent type component of this AgentId. More...
 
int currentRank () const
 Gets the current process rank of this AgentId. More...
 
void currentRank (int val)
 Sets the current process rank of this AgentId. More...
 
std::size_t hashcode () const
 Gets the hashcode for this AgentId. More...
 

Friends

class boost::serialization::access
 
std::ostream & operator<< (std::ostream &os, const AgentId &id)
 Writes the agent id to the ostream.
 
bool operator== (const AgentId &one, const AgentId &two)
 Equality operator.
 
bool operator< (const AgentId &one, const AgentId &two)
 A comparison operator for use with std::set.
 

Detailed Description

Agent identity information.

An Agent ID consists of four values: 1) a numerical identifier; 2) the process on which the agent was created; 3) a numerical identifier that indicates the agent's type (in simulation semantic terms, not a software object type); and 4) the process on which the agent is a local agent. Each agent should be uniquely identified by an AgentId using the first three of the four values, which should be immutable. The fourth value can change throughout the simulation.

Constructor & Destructor Documentation

◆ AgentId()

repast::AgentId::AgentId ( int  id,
int  startProc,
int  agentType,
int  currentProc = -1 
)

Creates an AgentId.

The combination of the first three parameters should uniquely identify the agent.

Parameters
idthe agent's id
startProcthe rank of the agent's starting process
agentTypethe agent's type (user defined)
currentProcthe rank where the agent is a local agent

Member Function Documentation

◆ agentType()

int repast::AgentId::agentType ( ) const
inline

Gets the agent type component of this AgentId.

Returns
the agent type component of this AgentId.

◆ currentRank() [1/2]

int repast::AgentId::currentRank ( ) const
inline

Gets the current process rank of this AgentId.

The current rank identifies which process the agent with this AgentId is currently on.

Returns
the current process rank of this AgentId.

◆ currentRank() [2/2]

void repast::AgentId::currentRank ( int  val)
inline

Sets the current process rank of this AgentId.

The current rank identifies which process the agent with this AgentId is currently on.

Parameters
valthe current process rank

◆ hashcode()

std::size_t repast::AgentId::hashcode ( ) const
inline

Gets the hashcode for this AgentId.

Returns
the hashcode for this AgentId.

◆ id()

int repast::AgentId::id ( ) const
inline

Gets the id component of this AgentId.

Returns
the id component of this AgentId.

◆ startingRank()

int repast::AgentId::startingRank ( ) const
inline

Gets the starting rank component of this AgentId.

Returns
the starting rank component of this AgentId.

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