Class LayerDescription
Defined in File LayerDescription.h
Inheritance Relationships
Base Type
public flamegpu::CLayerDescription
(Class CLayerDescription)
Class Documentation
-
class LayerDescription : public flamegpu::CLayerDescription
Within the model hierarchy, this class represents an execution layer for a FLAMEGPU model This class is used to configure which agent and host functions execute at a stage of the model’s execution
See also
ModelDescription::newLayer(const std::string&) For creating instances of this class
Public Functions
Constructor, creates an interface to the LayerData Constructors
- Parameters:
data – Data store of this layer’s data
-
LayerDescription(const LayerDescription &other_layer) = default
Copy constructor Creates a new interface to the same LayerData/ModelData
-
LayerDescription(LayerDescription &&other_layer) = default
-
LayerDescription &operator=(const LayerDescription &other_layer) = default
Assignment operator Assigns this interface to the same LayerData/ModelData
-
LayerDescription &operator=(LayerDescription &&other_layer) = default
-
template<typename AgentFn>
void addAgentFunction(AgentFn a = AgentFn()) Adds an agent function to this layer The agent function will be called during this stage of model execution
Note
The agent function must first be added to an Agent
- Parameters:
a – Agent function as defined using FLAMEGPU_AGENT_FUNCTION notation
- Template Parameters:
AgentFn – Struct containing agent function definition
- Throws:
exception::InvalidAgentFunc – If the agent function does not exist within the model hierarchy
exception::InvalidAgentFunc – If the agent function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
exception::InvalidLayerMember – If the agent function outputs to a message list output to by an existing agent function of the layer
-
void addAgentFunction(const CAgentFunctionDescription &afd)
Adds an agent function to this layer The agent function will be called during this stage of model execution
- Parameters:
afd – Agent function description to execute during this layer
- Throws:
exception::InvalidAgentFunc – If the agent function does not exist within the model hierarchy
exception::InvalidAgentFunc – If the agent function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
exception::InvalidLayerMember – If the agent function outputs to a message list output to by an existing agent function of the layer
exception::InvalidLayerMember – If the agent function outputs an agent in the same agent state as an existing agent function’s input state (or vice versa)
-
void addAgentFunction(const AgentFunctionDescription &afd)
Adds an agent function to this layer The agent function will be called during this stage of model execution
Accessors
Note
This additional version is required, to stop the template form of this method being used
- Parameters:
afd – Agent function description to execute during this layer
- Throws:
exception::InvalidAgentFunc – If the agent function does not exist within the model hierarchy
exception::InvalidAgentFunc – If the agent function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
exception::InvalidLayerMember – If the agent function outputs to a message list output to by an existing agent function of the layer
exception::InvalidLayerMember – If the agent function outputs an agent in the same agent state as an existing agent function’s input state (or vice versa)
-
void addAgentFunction(const std::string &agentName, const std::string &functionName)
Adds an agent function to this layer The agent function will be called during this stage of model execution
- Parameters:
agentName – Name of the agent which owns the function to execute during this layer
functionName – Name of the agent function description to execute during this layer
- Throws:
exception::InvalidAgentFunc – If the agent function does not exist within the model hierarchy
exception::InvalidAgentFunc – If the agent function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
exception::InvalidLayerMember – If the agent function outputs to a message list output to by an existing agent function of the layer
exception::InvalidLayerMember – If the agent function outputs an agent in the same agent state as an existing agent function’s input state (or vice versa)
-
void addAgentFunction(const char *agentName, const char *functionName)
Adds an agent function to this layer The agent function will be called during this stage of model execution
Note
This version exists because the template overload was preventing implicit cast to std::string
- Parameters:
agentName – Name of the agent which owns the function to execute during this layer
functionName – Name of the agent function description to execute during this layer
- Throws:
exception::InvalidAgentFunc – If the agent function does not exist within the model hierarchy
exception::InvalidAgentFunc – If the agent function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
exception::InvalidLayerMember – If the agent function outputs to a message list output to by an existing agent function of the layer
exception::InvalidLayerMember – If the agent function outputs an agent in the same agent state as an existing agent function’s input state (or vice versa)
-
void addHostFunction(FLAMEGPU_HOST_FUNCTION_POINTER func_p)
Adds a host function to this layer The host function will be called during this stage of model execution
Note
There is no guarantee on the order in which multiple host functions in the same layer will be executed
- Parameters:
func_p – Function pointer to the host function declared using FLAMEGPU_HOST_FUNCTION notation
- Throws:
exception::InvalidHostFunc – If the function has already been added to the layer
exception::InvalidLayerMember – If the layer already contains a SubModel
-
void addSubModel(const std::string &name)
Adds a submodel to a layer If layer contains a submodel, it may contain nothing else
- Parameters:
name – Name of the submodel (passed to ModelDescription::newSubModel() was called)
- Throws:
exception::InvalidLayerMember – If the layer already contains any agent functions or host functions
exception::InvalidSubModel – If the layer already contains a submodel
-
void addSubModel(const CSubModelDescription &submodel)
Adds a submodel to a layer If layer contains a submodel, it may contain nothing else
See also
- Parameters:
submodel – SubModel description of the layer to be bound
- Throws:
exception::InvalidLayerMember – If the layer already contains any agent functions or host functions
exception::InvalidSubModel – If the layer already contains a submodel