Class: Syskit::ActualDataFlowGraph
- Inherits:
-
ConnectionGraph
- Object
- Roby::Relations::Graph
- ConnectionGraph
- Syskit::ActualDataFlowGraph
- Defined in:
- lib/syskit/actual_data_flow_graph.rb
Overview
The graph that represents the connections on the actual ports
I.e. this is the set of connections that really exist between our components
Instance Attribute Summary collapse
-
#static_info ⇒ Hash<(Orocos::TaskContext,String),Boolean>
readonly
Information about which ports are static and which are not.
Attributes inherited from ConnectionGraph
Instance Method Summary collapse
-
#add_connections(source_task, sink_task, mappings) ⇒ Object
Registers a connection between two tasks.
-
#initialize ⇒ ActualDataFlowGraph
constructor
A new instance of ActualDataFlowGraph.
-
#static?(task, port) ⇒ Boolean
Whether the given port is static (per Port#static?.
Methods inherited from ConnectionGraph
#add_edge, #connected?, #each_in_connection, #each_out_connection, #freeze_edge_info, #has_in_connections?, #has_out_connections?, #merge_info, #remove_connections
Constructor Details
#initialize ⇒ ActualDataFlowGraph
Returns a new instance of ActualDataFlowGraph
14 15 16 17 |
# File 'lib/syskit/actual_data_flow_graph.rb', line 14 def initialize(*) super @static_info = Hash.new end |
Instance Attribute Details
#static_info ⇒ Hash<(Orocos::TaskContext,String),Boolean> (readonly)
Information about which ports are static and which are not. This information is critical during disconnection to force reconfiguration of the associated tasks
12 13 14 |
# File 'lib/syskit/actual_data_flow_graph.rb', line 12 def static_info @static_info end |
Instance Method Details
#add_connections(source_task, sink_task, mappings) ⇒ Object
Registers a connection between two tasks
Each element in the connection mappings represent one connection. It is of the form
[source_port_name, sink_port_name] => [policy, source_static, sink_static]
where policy is a connection policy hash, and source_static/sink_static are booleans indicating whether the source (resp. sink) ports are static per Port#static?.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/syskit/actual_data_flow_graph.rb', line 41 def add_connections(source_task, sink_task, mappings) # :nodoc: force_update = mappings.delete(:force_update) mappings = mappings.map_value do |(source_port, sink_port), info| if info.size != 3 raise ArgumentError, "ActualDataFlowGraph#add_connections expects the mappings to be of the form (source_port,sink_port) => [policy, source_static, sink_static]" end policy, source_static, sink_static = *info static_info[[source_task, source_port]] = source_static static_info[[sink_task, sink_port]] = sink_static policy end if !force_update || !has_edge?(source_task, sink_task) super(source_task, sink_task, mappings) else set_edge_info(source_task, sink_task, edge_info(source_task, sink_task).merge(mappings)) end end |
#static?(task, port) ⇒ Boolean
Whether the given port is static (per Port#static?
65 66 67 68 69 |
# File 'lib/syskit/actual_data_flow_graph.rb', line 65 def static?(task, port) static_info.fetch([task, port]) rescue KeyError raise ArgumentError, "no port #{port} on a task called #{task} is registered on #{self}" end |