Module: Syskit::Coordination::PortHandling

Defined in:
lib/syskit/coordination/port_handling.rb

Overview

Port access code for instance-level task objects

Instance Method Summary collapse

Instance Method Details

#find_port(port_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/syskit/coordination/port_handling.rb', line 9

def find_port(port_name)
    if model_port = model.find_port(port_name)
        case model_port
        when Syskit::Models::OutputPort
            OutputPort.new(model_port, model_port.component_model.bind(self))
        when Syskit::Models::InputPort
            InputPort.new(model_port, model_port.component_model.bind(self))
        end
    end
end

#find_through_method_missing(m, args) ⇒ Object



36
37
38
# File 'lib/syskit/coordination/port_handling.rb', line 36

def find_through_method_missing(m, args)
    MetaRuby::DSLs.find_through_method_missing(self, m, args, '_port' => :find_port) || super
end

#has_port?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/syskit/coordination/port_handling.rb', line 5

def has_port?
    !!model.find_port(port_name)
end

#has_through_method_missing?(m) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/syskit/coordination/port_handling.rb', line 32

def has_through_method_missing?(m)
    MetaRuby::DSLs.has_through_method_missing?(self, m, '_port' => :has_port?) || super
end

#self_port_to_component_port(port) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/syskit/coordination/port_handling.rb', line 20

def self_port_to_component_port(port)
    port_model   = port.model
    model_object = port_model.component_model
    component_model = model_object.model

    if respond_to?(:parent)
        component_model.resolve_and_bind_child(parent.resolve).self_port_to_component_port(port)
    else
        component_model.bind(self.resolve).self_port_to_component_port(port)
    end
end