fpmas 1.6
Static Public Member Functions | List of all members
fpmas::synchro::DataUpdate< api::model::AgentPtr > Struct Reference

#include <model.h>

Static Public Member Functions

static void update (api::model::AgentPtr &local_agent, api::model::AgentPtr &&updated_agent)
 

Detailed Description

AgentPtr data update specialization.

In addition to move the updated agent data into the local agent, the update() method also updates the local agents groups.

Member Function Documentation

◆ update()

static void fpmas::synchro::DataUpdate< api::model::AgentPtr >::update ( api::model::AgentPtr local_agent,
api::model::AgentPtr &&  updated_agent 
)
inlinestatic

Updates the local agent with the updated agent data.

The local agent groups are also updated according to the following rules:

  • the local agent is added to groups corresponding to ids contained in updated_agent->groupIds() but not in local_agent->groupIds() (see api::model::AgentGroup::add())
  • this agent is removed from groups corresponding to ids contained in local_agent->groupIds() but not in updated_agent->groupIds() (see api::model::AgentGroup::remove())
  • other groups are left unchanged.

local_agent->groupIds() is also updated according to the previous rules.

local_agent.tasks() and local_agent.groups() are assumed to stay consistent with the rules expressed above, since tasks are bound to agent groups to which the agent belong. Those fields are updated automatically by api::model::AgentGroup::add() and api::model::AgentGroup::remove().

Agent data is pulled from updated_agent to local_agent using the api::model::AgentPtr move assignment operator.

Parameters
local_agentreference to the local agent to update
updated_agentreference to the temporary updated agent

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