Module: Roby::ConflictEventHandling

Included in:
TaskEventGenerator
Defined in:
lib/roby/relations/conflicts.rb

Instance Method Summary collapse

Instance Method Details

#calling(context) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/roby/relations/conflicts.rb', line 34

def calling(context)
    super if defined? super
    return unless symbol == :start

    # Check for conflicting tasks
    result = nil
    task.each_conflicts do |conflicting_task|
	result ||= ValueSet.new
	result << conflicting_task
    end

    if result
	Roby.decision_control.conflict(task, result)
    end

    # Add the needed conflict relations
    models = task.class.conflicting_models
    for model in models
	if candidates = plan.task_index.by_model[model]
	    for t in candidates
		t.conflicts_with task if t.pending?
	    end
	end
    end
end

#fired(event) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/roby/relations/conflicts.rb', line 60

def fired(event)
    super if defined? super

    if symbol == :stop
	TaskStructure::Conflicts.remove(task)
    end
end