module Syskit::DataService

Public Instance Methods

using_data_service?(source_name) click to toggle source

Returns true if at least one port of the given service (designated by its name) is connected to something.

# File lib/syskit/data_service.rb, line 10
def using_data_service?(source_name)
    service = model.find_data_service(source_name)
    inputs  = service.each_task_input_port.map(&:name)
    outputs = service.each_task_output_port.map(&:name)

    each_source do |output|
        description = output[self, Flows::DataFlow]
        if description.any? { |(_, to), _| inputs.include?(to) }
            return true
        end
    end
    each_sink do |input, description|
        if description.any? { |(from, _), _| outputs.include?(from) }
            return true
        end
    end
    false
end