class Roby::Coordination::Models::TaskWithDependencies

Generic representation of an execution context task that can be instanciated

Attributes

dependencies[R]

@return [Set<(Task,String)>] set of dependencies needed for this

task, as a (task,role) pair

Public Class Methods

new(model) click to toggle source

(see Task#initialize)

Calls superclass method Roby::Coordination::Models::Task::new
# File lib/roby/coordination/models/task_with_dependencies.rb, line 12
def initialize(model)
    super
    @dependencies = Set.new
end

Public Instance Methods

depends_on(action, role: nil) click to toggle source
# File lib/roby/coordination/models/task_with_dependencies.rb, line 38
def depends_on(action, role: nil)
    if !action.kind_of?(Coordination::Models::Task)
        raise ArgumentError, "expected a task, got #{action}. You probably forgot to convert it using #task or #state"
    end
    dependencies << [action, role]
    self
end
find_child_model(name) click to toggle source
# File lib/roby/coordination/models/task_with_dependencies.rb, line 31
def find_child_model(name)
    if d = dependencies.find { |_, role| role == name }
        d[0].model
    else super
    end
end
initialize_copy(old) click to toggle source
Calls superclass method
# File lib/roby/coordination/models/task_with_dependencies.rb, line 17
def initialize_copy(old)
    super
    @dependencies = @dependencies.dup
end
map_tasks(mapping) click to toggle source

Modify this task's internal structure to change relationships between tasks

# File lib/roby/coordination/models/task_with_dependencies.rb, line 24
def map_tasks(mapping)
    super
    @dependencies = dependencies.map do |task, role|
        [mapping[task] || task, role]
    end
end