module Syskit::PlaceholderTask::ClassExtension

Attributes

proxied_data_services[RW]
proxied_task_context_model[RW]

Public Instance Methods

component_model?() click to toggle source

Whether this proxies only services or not

# File lib/syskit/models/component.rb, line 1139
def component_model?
    proxied_task_context_model != Component
end
each_fullfilled_model(&block) click to toggle source
# File lib/syskit/models/component.rb, line 1134
def each_fullfilled_model(&block)
    fullfilled_model.each(&block)
end
each_input_port() { |p| ... } click to toggle source
# File lib/syskit/models/component.rb, line 1202
def each_input_port
    return enum_for(:each_input_port) if !block_given?
    @input_port_models.each_value do |list|
        list.each { |p| yield(p) }
    end
end
each_output_port() { |p| ... } click to toggle source
# File lib/syskit/models/component.rb, line 1195
def each_output_port
    return enum_for(:each_output_port) if !block_given?
    @output_port_models.each_value do |list|
        list.each { |p| yield(p) }
    end
end
each_port() { |p| ... } click to toggle source
# File lib/syskit/models/component.rb, line 1209
def each_port
    return enum_for(:each_port) if !block_given?
    each_output_port { |p| yield(p) }
    each_input_port { |p| yield(p) }
end
each_required_model() { |proxied_task_context_model| ... } click to toggle source
# File lib/syskit/models/component.rb, line 1158
def each_required_model
    return enum_for(:each_required_model) if !block_given?
    if component_model?
        yield(proxied_task_context_model)
    end
    proxied_data_services.each do |m|
        yield(m)
    end
end
find_input_port(name) click to toggle source
# File lib/syskit/models/component.rb, line 1221
def find_input_port(name)
    if list = @input_port_models[name]
        list.first
    end
end
find_output_port(name) click to toggle source
# File lib/syskit/models/component.rb, line 1215
def find_output_port(name)
    if list = @output_port_models[name]
        list.first
    end
end
find_port(name) click to toggle source
# File lib/syskit/models/component.rb, line 1227
def find_port(name)
    find_output_port(name) || find_input_port(name)
end
find_through_method_missing(m, args) click to toggle source
Calls superclass method
# File lib/syskit/models/component.rb, line 1259
def find_through_method_missing(m, args)
    MetaRuby::DSLs.find_through_method_missing(
        self, m, args,
        '_port'.freeze => :find_port) || super
end
fullfilled_model() click to toggle source
# File lib/syskit/models/component.rb, line 1143
def fullfilled_model
    result = Set.new
    if component_model?
        proxied_task_context_model.each_fullfilled_model do |m|
            result << m
        end
    end
    proxied_data_services.each do |srv|
        srv.each_fullfilled_model do |m|
            result << m
        end
    end
    result
end
has_port?(name) click to toggle source
# File lib/syskit/models/component.rb, line 1231
def has_port?(name)
    @input_port_models.has_key?(name.to_s) ||
        @output_port_models.has_key?(name.to_s)
end
has_through_method_missing?(m) click to toggle source
Calls superclass method
# File lib/syskit/models/component.rb, line 1253
def has_through_method_missing?(m)
    MetaRuby::DSLs.has_through_method_missing?(
        self, m,
        '_port'.freeze => :has_port?) || super
end
merge(other_model) click to toggle source
# File lib/syskit/models/component.rb, line 1168
def merge(other_model)
    if other_model.kind_of?(Models::BoundDataService)
        return other_model.merge(self)
    end

    task_model, service_models, other_service_models = proxied_task_context_model, proxied_data_services, []
    if other_model.respond_to?(:proxied_data_services)
        task_model = task_model.merge(other_model.proxied_task_context_model)
        other_service_models = other_model.proxied_data_services
    else
        task_model = task_model.merge(other_model)
    end

    model_list = Models.merge_model_lists(service_models, other_service_models)

    # Try to keep the type of submodels of PlaceholderTask for as
    # long as possible. We re-create a proxy only when needed
    if self <= task_model && model_list.all? { |m| service_models.include?(m) }
        return self
    elsif other_model <= task_model && model_list.all? { |m| other_service_models.include?(m) }
        return other_model
    end

    model_list = Models.merge_model_lists([task_model], model_list)
    Syskit.proxy_task_model_for(model_list)
end
placeholder_task?() click to toggle source
# File lib/syskit/models/component.rb, line 1249
def placeholder_task?
    true
end
to_instance_requirements() click to toggle source
# File lib/syskit/models/component.rb, line 1130
def to_instance_requirements
    Syskit::InstanceRequirements.new([self])
end
update_proxy_mappings() click to toggle source
# File lib/syskit/models/component.rb, line 1236
def update_proxy_mappings
    @output_port_models = Hash.new
    @input_port_models = Hash.new
    each_required_model do |m|
        m.each_output_port do |port|
            (@output_port_models[port.name] ||= Array.new) << port.attach(self)
        end
        m.each_input_port  do |port|
            (@input_port_models[port.name] ||= Array.new) << port.attach(self)
        end
    end
end