module Roby::TaskStructure::Dependency::ModelExtension
Public Instance Methods
each_fullfilled_model(&block)
click to toggle source
Enumerates the models that all instances of this task model fullfill
@yieldparam [Model<Task>,Model<TaskService>] model @return [void]
# File lib/roby/task_structure/dependency.rb, line 834 def each_fullfilled_model(&block) fullfilled_model.each(&block) end
explicit_fullfilled_model()
click to toggle source
Returns an explicitly set {#fullfilled_model}
@return [nil,Array<Models::Task,TaskService>] either nil if no
explicit model has been set, or the list of models it must fullfill
# File lib/roby/task_structure/dependency.rb, line 785 def explicit_fullfilled_model; @fullfilled_model end
explicit_fullfilled_model?()
click to toggle source
True if a fullfilled model has been explicitly set on self @return [Boolean]
# File lib/roby/task_structure/dependency.rb, line 779 def explicit_fullfilled_model?; !!@fullfilled_model end
fullfilled_model()
click to toggle source
Returns the model that all instances of this taks model fullfill
(see Dependency::Extension#fullfilled_model
)
# File lib/roby/task_structure/dependency.rb, line 826 def fullfilled_model explicit_fullfilled_model || implicit_fullfilled_model end
fullfilled_model=(models)
click to toggle source
Specifies the models that all instances of this task must fullfill
This is usually used to under-constraint the model instances
@param [Array<Models::Task,TaskService>] the list of models
# File lib/roby/task_structure/dependency.rb, line 792 def fullfilled_model=(models) if !models.respond_to?(:to_ary) raise ArgumentError, "expected an array, got #{models}" elsif !models.all? { |t| t.kind_of?(Roby::Models::TaskServiceModel) || (t.respond_to?(:<=) && (t <= Roby::Task)) } raise ArgumentError, "expected a submodel of TaskService, got #{models}" end @fullfilled_model = models end
implicit_fullfilled_model()
click to toggle source
@api private
@return [Array<Models::Task,TaskService>] the list of models
fullfilled by this task
# File lib/roby/task_structure/dependency.rb, line 806 def implicit_fullfilled_model if !@implicit_fullfilled_model @implicit_fullfilled_model = Array.new ancestors.each do |m| next if m.singleton_class? if m.kind_of?(Class) || (m.kind_of?(Roby::Models::TaskServiceModel) && m != Roby::TaskService) @implicit_fullfilled_model << m end if m == Roby::Task break end end end @implicit_fullfilled_model end