Module: Syskit::Coordination::Models::TaskExtension
- Defined in:
- lib/syskit/coordination/models/task_extension.rb
Instance Method Summary collapse
-
#data_monitoring_arguments ⇒ Object
Mapping from data monitoring arguments to coordination context variables.
-
#data_monitoring_table ⇒ Object
Returns the data monitoring table that should be added to all instances of this task.
-
#monitor(name, *data_streams) ⇒ Object
Add a data monitor on this particular coordination task.
- #setup_instanciated_task(coordination_context, task, arguments = Hash.new) ⇒ Object
Instance Method Details
#data_monitoring_arguments ⇒ Object
Mapping from data monitoring arguments to coordination context variables
12 13 14 |
# File 'lib/syskit/coordination/models/task_extension.rb', line 12 def data_monitoring_arguments @data_monitoring_arguments ||= Hash.new end |
#data_monitoring_table ⇒ Object
Returns the data monitoring table that should be added to all instances of this task
7 8 9 |
# File 'lib/syskit/coordination/models/task_extension.rb', line 7 def data_monitoring_table @data_monitoring_table ||= Syskit::Coordination::DataMonitoringTable.new_submodel(:root => model) end |
#monitor(name, *data_streams) ⇒ Object
Add a data monitor on this particular coordination task
It will be added to all the instances of this task
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/syskit/coordination/models/task_extension.rb', line 19 def monitor(name, *data_streams) if data_streams.last.kind_of?(Hash) = Kernel. data_streams.pop .each do |key, value| if key.respond_to?(:to_sym) && value.kind_of?(Roby::Coordination::Models::Variable) data_monitoring_arguments[value.name] = key data_monitoring_table.argument key end end end data_monitoring_table.monitor(name, *data_streams) end |
#setup_instanciated_task(coordination_context, task, arguments = Hash.new) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/syskit/coordination/models/task_extension.rb', line 33 def setup_instanciated_task(coordination_context, task, arguments = Hash.new) table_arguments = Hash.new arguments.each do |key, value| if var = data_monitoring_arguments[key] table_arguments[var] = value end end data_monitoring_table.new( task, table_arguments, on_replace: :copy, parent: coordination_context) super end |