Class CAgentDescription

Inheritance Relationships

Derived Type

Class Documentation

class CAgentDescription

Subclassed by flamegpu::AgentDescription

Public Functions

explicit CAgentDescription(std::shared_ptr<AgentData> data)

Constructor, creates an interface to the AgentData

Parameters:

data – Data store of this agent’s data

explicit CAgentDescription(std::shared_ptr<const AgentData> data)
CAgentDescription(const CAgentDescription &other_agent) = default

Copy constructor Creates a new interface to the same AgentData/ModelData

CAgentDescription(CAgentDescription &&other_agent) = default
CAgentDescription &operator=(const CAgentDescription &other_agent) = default

Assignment operator Assigns this interface to the same AgentData/ModelData

CAgentDescription &operator=(CAgentDescription &&other_agent) = default
bool operator==(const CAgentDescription &rhs) const

Equality operator, checks whether AgentDescription hierarchies are functionally the same

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, checks whether AgentDescription 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

std::string getName() const

Const Accessors

Returns:

The agent’s name

flamegpu::size_type getStatesCount() const
Returns:

The number of possible states agents of this type can enter

std::string getInitialState() const
Returns:

The state which newly created agents of this type begin in

const std::type_index &getVariableType(const std::string &variable_name) const
Parameters:

variable_name – Name used to refer to the desired variable

Throws:

exception::InvalidAgentVar – If a variable with the name does not exist within the agent

Returns:

The type of the named variable

size_t getVariableSize(const std::string &variable_name) const
Parameters:

variable_name – Name used to refer to the desired variable

Throws:

exception::InvalidAgentVar – If a variable with the name does not exist within the agent

Returns:

The size of the named variable’s type

flamegpu::size_type getVariableLength(const std::string &variable_name) const
Parameters:

variable_name – Name used to refer to the desired variable

Throws:

exception::InvalidAgentVar – If a variable with the name does not exist within the agent

Returns:

The number of elements in the name variable (1 if it isn’t an array)

flamegpu::size_type getVariablesCount() const

Get the total number of variables this agent has

Note

This count includes internal variables used to track things such as agent ID

Returns:

The total number of variables within the agent

CAgentFunctionDescription getFunction(const std::string &function_name) const

Returns an immutable reference to the named agent function

See also

AgentDescription::Function(const std::string &) for the mutable version

Parameters:

function_name – Name used to refer to the desired agent function

Throws:

exception::InvalidAgentFunc – If a function with the name does not exist within the agent

Returns:

An immutable reference to the specified AgentFunctionDescription

flamegpu::size_type getFunctionsCount() const

Get the total number of functions this agent has

Returns:

The total number of functions within the agent

flamegpu::size_type getAgentOutputsCount() const

The total number of agent functions, within the ModelDescription hierarchy, which create new agents of this type

Returns:

The total number of agent functions within the ModelDescription hierarchy which create new agents of this type

bool hasState(const std::string &state_name) const
Parameters:

state_name – Name of the state to check

Returns:

True when a state with the specified name exists within the agent

bool hasVariable(const std::string &variable_name) const
Parameters:

variable_name – Name of the variable to check

Returns:

True when a variable with the specified name exists within the agent

bool hasFunction(const std::string &function_name) const
Parameters:

function_name – Name of the function to check

Returns:

True when a function with the specified name exists within the agent

bool isOutputOnDevice() const

Check whether any agent functions output agents of this type

Returns:

True if any agent functions, with the model hierarchy, create new agents of this type

const std::set<std::string> &getStates() const

Get the set of possible states for an agent of this type

Returns:

An immutable reference to the set of states agents of this type can enter

Protected Attributes

std::shared_ptr<AgentData> agent

The class which stores all of the agent’s data.

Friends

friend struct visualiser::AgentVisData