Module: Roby::TaskStructure::ExecutionAgent::ModelExtension

Defined in:
lib/roby/task_structure/executed_by.rb

Overview

This module defines model-level definition of execution agent, for instance to Roby::Task

Instance Method Summary collapse

Instance Method Details

#executed_by(agent_model, arguments = {}) ⇒ Object

Defines a model of execution agent. Doing

TaskModel.executed_by ExecutionAgentModel

is equivalent to

task = TaskModel.new
exec = <find a suitable ExecutionAgentModel instance in the plan or
       create a new one>
task.executed_by exec

for all instances of TaskModel. The actual job is done in the ExecutionAgentSpawn module



93
94
95
# File 'lib/roby/task_structure/executed_by.rb', line 93

def executed_by(agent_model, arguments = {})
    @execution_agent = [agent_model, arguments]
end

#execution_agentObject

The model of execution agent for this class



71
72
73
74
75
76
77
78
# File 'lib/roby/task_structure/executed_by.rb', line 71

def execution_agent
    ancestors.each do |klass|
        if klass.instance_variable_defined?(:@execution_agent)
            return klass.instance_variable_get(:@execution_agent)
        end
    end
    nil
end