module Syskit::PortAccess
Mixin used to define common methods to enumerate ports on objects that have a model that includes Syskit::Models::PortAccess
Public Instance Methods
Enumerates this component's input ports
# File lib/syskit/port_access.rb, line 42 def each_input_port return enum_for(:each_input_port) if !block_given? model.each_input_port do |p| yield(p.bind(self)) end end
Enumerates this component's output ports
# File lib/syskit/port_access.rb, line 34 def each_output_port return enum_for(:each_output_port) if !block_given? model.each_output_port do |p| yield(p.bind(self)) end end
Enumerates all of this component's ports
# File lib/syskit/port_access.rb, line 50 def each_port return enum_for(:each_port) if !block_given? each_output_port { |p| yield(p) } each_input_port { |p| yield(p) } end
Returns the input port with the given name, or nil if it does not exist.
# File lib/syskit/port_access.rb, line 27 def find_input_port(name) if m = model.find_input_port(name) return m.bind(self) end end
Returns the output port with the given name, or nil if it does not exist.
# File lib/syskit/port_access.rb, line 19 def find_output_port(name) if m = model.find_output_port(name) return m.bind(self) end end
Returns the port object that maps to the given name, or nil if it does not exist.
# File lib/syskit/port_access.rb, line 7 def find_port(name) name = name.to_str find_output_port(name) || find_input_port(name) end
# File lib/syskit/port_access.rb, line 75 def find_through_method_missing(m, args) MetaRuby::DSLs.find_through_method_missing( self, m, args, '_port' => :find_port) || super end
Returns true if name is a valid input port name for instances
of self. If including_dynamic is set to false, only static
ports will be considered
# File lib/syskit/port_access.rb, line 66 def has_input_port?(name, including_dynamic = true) return !!find_input_port(name) end
Returns true if name is a valid output port name for instances
of self. If including_dynamic is set to false, only static
ports will be considered
# File lib/syskit/port_access.rb, line 59 def has_output_port?(name, including_dynamic = true) return !!find_output_port(name) end
# File lib/syskit/port_access.rb, line 12 def has_port?(name) name = name.to_str has_input_port?(name) || has_output_port?(name) end
# File lib/syskit/port_access.rb, line 70 def has_through_method_missing?(m) MetaRuby::DSLs.has_through_method_missing?( self, m, '_port' => :has_port?) || super end