Class: Roby::Coordination::Task

Inherits:
TaskBase show all
Defined in:
lib/roby/coordination/task.rb

Overview

Representation of a toplevel task in an execution context instance

Direct Known Subclasses

Models::Root

Instance Attribute Summary collapse

Attributes inherited from TaskBase

#execution_context, #model

Instance Method Summary collapse

Methods inherited from TaskBase

#find_child, #find_event, #find_through_method_missing, #has_through_method_missing?, #to_coordination_task

Constructor Details

#initialize(execution_context, model) ⇒ Task

Returns a new instance of Task.



9
10
11
12
# File 'lib/roby/coordination/task.rb', line 9

def initialize(execution_context, model)
    super(execution_context, model)
    @task  = nil
end

Instance Attribute Details

#tasknil, Roby::Task (readonly)

Returns the actual Roby task this is representing.

Returns:

  • (nil, Roby::Task)

    the actual Roby task this is representing



7
8
9
# File 'lib/roby/coordination/task.rb', line 7

def task
  @task
end

Instance Method Details

#bind(task) ⇒ Object

Associate this coordination task to the given roby task

This sets the next value returned by #resolve

Parameters:



23
24
25
# File 'lib/roby/coordination/task.rb', line 23

def bind(task)
    @task = task
end

#nameObject



37
38
39
# File 'lib/roby/coordination/task.rb', line 37

def name
    model.name
end

#resolveRoby::Task

Resolves this to the actual task object

Returns:

Raises:

  • ResolvingUnboundObject



31
32
33
34
35
# File 'lib/roby/coordination/task.rb', line 31

def resolve
    if task then task
    else raise ResolvingUnboundObject, "trying to resolve #{self}, which is not (yet) bound"
    end
end

#root_taskObject



14
15
16
# File 'lib/roby/coordination/task.rb', line 14

def root_task
    self
end

#to_sObject



41
# File 'lib/roby/coordination/task.rb', line 41

def to_s; "Task[#{model.model}]" end