Class SubAgentDescription

Class Documentation

class SubAgentDescription

This class provides an interface to a mapping between a parent and submodel agent

Public Functions

void mapState(const std::string &sub_state_name, const std::string &master_state_name)

Links the named states between the master and sub agent

Parameters
  • sub_state_name – Name of the state in the sub models agent

  • master_state_name – Name of the state in the master models agent

Throws
  • InvalidParent – If the sub agent or master agent weak_ptrs have expired (this should never happen)

  • InvalidAgentState – If the named state does not exist within the bound sub or master agent

void mapVariable(const std::string &sub_variable_name, const std::string &master_variable_name)

Links the named variables between the master and sub agent These variables must have the same type and number of elements (1 unless they’re an array variable)

Parameters
  • sub_variable_name – Name of the variable in the sub models agent

  • master_variable_name – Name of the variable in the master models agent

Throws
  • InvalidParent – If the sub agent or master agent weak_ptrs have expired (this should never happen)

  • InvalidAgentVar – If the named variable does not exist within the bound sub or master agent

  • InvalidAgentVar – If there is a mismatch between the variables types or number of elements

std::string getStateMapping(const std::string &sub_state_name)

Returns the master agent state which has been mapped to the name subagent state

Parameters

sub_state_name – Name of the state in the sub agent to check

Throws

InvalidAgentState – If the sub agent state does not exist or has not been mapped yet

Returns

The name of the state within the master agent which is mapped

std::string getVariableMapping(const std::string &sub_variable_name)

Returns the master agent variable which has been mapped to the name subagent variable

Parameters

sub_variable_name – Name of the variable in the sub agent to check

Throws

InvalidAgentVar – If the sub agent variable does not exist or has not been mapped yet

Returns

The name of the variable within the master agent which is mapped