Exception: Syskit::AmbiguousImplicitServiceSelection

Inherits:
AmbiguousServiceSelection show all
Defined in:
lib/syskit/exceptions.rb

Overview

Exception raised during the merge steps, if a merge is possible (i.e. a task provides the required service), but ambiguous

Instance Attribute Summary collapse

Attributes inherited from AmbiguousServiceSelection

#candidates, #required_service, #task_model

Instance Method Summary collapse

Constructor Details

#initialize(task, merged_task, required_service, candidates) ⇒ AmbiguousImplicitServiceSelection

Returns a new instance of AmbiguousImplicitServiceSelection



257
258
259
260
261
262
263
264
# File 'lib/syskit/exceptions.rb', line 257

def initialize(task, merged_task, required_service, candidates)
    super(task.model, required_service, candidates)

    @task = task
    @merged_task = merged_task
    @compositions = merged_task.parent_objects(Roby::TaskStructure::Dependency).
        map { |parent| [parent, parent[merged_task, Roby::TaskStructure::Dependency].dup] }
end

Instance Attribute Details

#compositionsObject (readonly)

Returns the value of attribute compositions



255
256
257
# File 'lib/syskit/exceptions.rb', line 255

def compositions
  @compositions
end

#merged_taskObject (readonly)

Returns the value of attribute merged_task



254
255
256
# File 'lib/syskit/exceptions.rb', line 254

def merged_task
  @merged_task
end

#taskObject (readonly)

Returns the value of attribute task



253
254
255
# File 'lib/syskit/exceptions.rb', line 253

def task
  @task
end

Instance Method Details

#pretty_print(pp) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/syskit/exceptions.rb', line 266

def pretty_print(pp)
    pp.text "error while trying to use #{task} instead of #{merged_task}"
    pp.breakable
    pp.text "#{merged_task} is part of the following compositions:"
    pp.nest(2) do
        pp.seplist(compositions) do |parent|
            parent_task, dependency_options = *parent
            pp.breakable
            pp.text "child #{dependency_options[:roles].to_a.join(", ")} of #{parent_task}"
        end
    end
    pp.breakable
    super
end