class Syskit::ConflictingDeviceAllocation

Attributes

device[R]
inputs[R]
tasks[R]

Public Class Methods

new(device, task0, task1) click to toggle source
# File lib/syskit/exceptions.rb, line 444
def initialize(device, task0, task1)
    @device, @tasks = device, [task0, task1]
    @can_merge = task0.can_merge?(task1) || task1.can_merge?(task0)
    if can_merge?
        # Mismatching inputs ... gather more info
        @inputs = Array.new
        @inputs[0] = task0.each_concrete_input_connection.to_a
        @inputs[1] = task1.each_concrete_input_connection.to_a
    end
end

Public Instance Methods

can_merge?() click to toggle source
# File lib/syskit/exceptions.rb, line 442
def can_merge?; !!@can_merge end
pretty_print(pp) click to toggle source
# File lib/syskit/exceptions.rb, line 455
def pretty_print(pp)
    pp.text "device #{device.name} is assigned to two tasks"
    if can_merge?
        pp.text " that have mismatching inputs"
        tasks.each_with_index do |t, i|
            pp.breakable
            t.pretty_print(pp)
            pp.breakable
            pp.text "#{inputs[i].size} input(s):"
            inputs[i].each do |source_task, source_port, sink_port|
                pp.breakable
                pp.text "  #{source_task}.#{source_port} -> #{sink_port}"
            end
        end
    else
        pp.text " that cannot be merged"
        tasks.each do |t|
            pp.breakable
            t.pretty_print(pp)
        end
    end
end