Struct AgentData

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< AgentData >

Struct Documentation

struct AgentData : public std::enable_shared_from_this<AgentData>

This is the internal data store for AgentDescription Users should only access that data stored within via an instance of AgentDescription

Public Types

typedef std::unordered_map<std::string, std::shared_ptr<AgentFunctionData>> FunctionMap

Map of name:agent function definition map<string, AgentFunctionData>

Public Functions

bool isOutputOnDevice() const

Check whether any agent functions within the ModelDescription hierarchy output agents of this type

Returns:

true if this type of agent is created by any agent functions

bool operator==(const AgentData &rhs) const

Equality operator

Note

Instead compare pointers if you wish to check that they are the same instance

Parameters:

rhs – Right hand side

Returns:

True when agents are the same

bool operator==(const CAgentDescription &rhs) const

Equality operator

Parameters:

rhs – Right hand side

Returns:

True when agents are the same

bool operator!=(const AgentData &rhs) const

Equality operator, checks whether AgentData hierarchies are functionally different

Note

Instead compare pointers if you wish to check that they are not the same instance

Parameters:

rhs – Right hand side

Returns:

True when agents are not the same

AgentData(const AgentData &other) = delete

Default copy constructor, not implemented

std::shared_ptr<const AgentData> clone() const

Returns a constant copy of this agent’s hierarchy Does not copy description, sets it to nullptr instead

Returns:

A shared ptr to a copy

Public Members

std::weak_ptr<const ModelData> model

Parent model

FunctionMap functions

Holds all of the agent’s function definitions

VariableMap variables

Holds all of the agent’s variable definitions

std::set<std::string> states

Holds all of the agent’s possible states

std::string initial_state

The initial state of newly created agents

Note

must be found within member set states

unsigned int agent_outputs

The number of functions that have agent output of this agent type This value is modified by AgentFunctionDescription

std::string name

Name of the agent, used to refer to the agent in many functions

bool keepDefaultState

Internal value used to track whether the user has requested the default state as a state

unsigned int sortPeriod

Sort the agent every sortPeriod steps. 0 means no sorting.

Protected Functions

AgentData(std::shared_ptr<const ModelData> model, const AgentData &other)

Copy constructor This is unsafe, should only be used internally, use clone() instead This does not setup functions map

Parameters:
  • model – New parent model (we do not copy the other AgentData’s parent model)

  • other – Other AgentData to copy data from

AgentData(std::shared_ptr<const ModelData> model, const std::string &agent_name)

Normal constructor, only to be called by ModelDescription

Parameters:
  • model – Parent model

  • agent_name – Name of the agent

Friends

friend class ModelDescription
friend struct ModelData
friend class DependencyGraph