class Roby::Coordination::TaskBase

Base functionality for task-like objects in coordination models (Task, Child)

Attributes

execution_context[R]

@return [Base] the underlying execution context

model[R]

@return [Coordination::Models::Task]

Public Class Methods

new(execution_context, model) click to toggle source
# File lib/roby/coordination/task_base.rb, line 13
def initialize(execution_context, model)
    @execution_context = execution_context
    @model = model
end

Public Instance Methods

find_child(role, child_model = nil) click to toggle source
# File lib/roby/coordination/task_base.rb, line 24
def find_child(role, child_model = nil)
    child_model ||= model.find_child_model(role)
    if !child_model
        begin
            task = self.resolve
            if child_task = task.find_child_from_role(role)
                child_model = child_task.model
            end
        rescue ResolvingUnboundObject
        end
    end

    if child = model.find_child(role, child_model)
        execution_context.instance_for(child)
    end
end
find_event(symbol) click to toggle source
# File lib/roby/coordination/task_base.rb, line 41
def find_event(symbol)
    if event = model.find_event(symbol)
        execution_context.instance_for(event)
    end
end
find_through_method_missing(m, args) click to toggle source
Calls superclass method
# File lib/roby/coordination/task_base.rb, line 47
def find_through_method_missing(m, args)
    MetaRuby::DSLs.find_through_method_missing(
        self, m, args,
        '_child' => :find_child,
        '_port'  => :find_port,
        '_event' => :find_event) || super
end
has_through_method_missing?(m) click to toggle source
Calls superclass method
# File lib/roby/coordination/task_base.rb, line 54
def has_through_method_missing?(m)
    MetaRuby::DSLs.has_through_method_missing?(
        self, m,
        '_child' => :has_child?,
        '_port'  => :has_port?,
        '_event' => :has_event?) || super
end
resolve() click to toggle source

Method that must be reimplemented in the task objects actually used in the coordination primitives

# File lib/roby/coordination/task_base.rb, line 20
def resolve
    raise NotImplementedError, "#resolve must be reimplemented in objects meant to be used in the coordination primitives"
end
to_coordination_task(task_model) click to toggle source
# File lib/roby/coordination/task_base.rb, line 64
def to_coordination_task(task_model); model.to_coordination_task(task_model) end