Define FLAMEGPU_AGENT_FUNCTION

Define Documentation

FLAMEGPU_AGENT_FUNCTION(funcName, msg_in, msg_out)

Macro for defining agent transition functions with the correct input. Must always be a device function to be called by CUDA.

struct SomeAgentFunction { // User Implemented agent function behaviour device forceinline FLAME_GPU_AGENT_STATUS operator()(DeviceAPI<msg_in, msg_out> *FLAMEGPU) const { // do something return 0; } // Returns a function pointer to the agent function wrapper for this function // Including it here, force instantiates the template, without requiring the user to specify the template args elsewhere static constexpr AgentFunctionWrapper *fnPtr() { return &agent_function_wrapper<SomeAgentFunction, msg_in, msg_out>; } // These are used to validate that the bound message description matches the specified type static constexpr std::type_index inType() { return std::type_index(typeid(msg_in)); } static constexpr std::type_index outType() { return std::type_index(typeid(msg_out)); } }; }