Class: Roby::Coordination::Models::Child

Inherits:
Task show all
Defined in:
lib/roby/coordination/models/child.rb

Overview

A representation of a task of the execution context’s task

Instance Attribute Summary collapse

Attributes inherited from Task

#model, #name

Instance Method Summary collapse

Methods inherited from Task

#can_resolve_child_models?, #find_child, #find_child_model, #find_event, #find_through_method_missing, #has_child?, #has_event?, #has_through_method_missing?, #instanciate, #map_tasks, #rebind, #setup_instanciated_task, #to_coordination_task

Constructor Details

#initialize(parent, role, model) ⇒ Child

Returns a new instance of Child.



13
14
15
16
17
# File 'lib/roby/coordination/models/child.rb', line 13

def initialize(parent, role, model)
    super(model)

    @parent, @role = parent, role
end

Instance Attribute Details

#parentBase, Child (readonly)

Returns the child’s parent.

Returns:



9
10
11
# File 'lib/roby/coordination/models/child.rb', line 9

def parent
  @parent
end

#roleString (readonly)

Returns the child’s role, relative to its parent.

Returns:

  • (String)

    the child’s role, relative to its parent



11
12
13
# File 'lib/roby/coordination/models/child.rb', line 11

def role
  @role
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
22
23
24
# File 'lib/roby/coordination/models/child.rb', line 19

def ==(other)
    other.kind_of?(Child) &&
        other.parent == parent &&
        other.role == role &&
        other.model == model
end

#new(execution_context) ⇒ Coordination::Child

Returns:



27
28
29
# File 'lib/roby/coordination/models/child.rb', line 27

def new(execution_context)
    Coordination::Child.new(execution_context, self)
end

#to_sObject



31
32
33
# File 'lib/roby/coordination/models/child.rb', line 31

def to_s
    "#{parent}.#{role}_child[#{model}]"
end