Module: Syskit::Coordination::Models::DataMonitoringTable
- Includes:
- MetaRuby::DSLs::FindThroughMethodMissing, Roby::Coordination::Models::Base
- Included in:
- DataMonitoringTable
- Defined in:
- lib/syskit/coordination/models/data_monitoring_table.rb
Overview
Model-level API for data monitoring tables
Instance Method Summary collapse
-
#all_attachment_point ⇒ Array<#===>
The union, along the class hierarchy, of all the values stored in attachment_point.
-
#all_monitor ⇒ Array<DataMonitor>
The union, along the class hierarchy, of all the values stored in monitor.
- #apply_block(&block) ⇒ Object
-
#attach_to(query) ⇒ Object
Declares that this table should be attached to the tasks matching the given query.
-
#attachment_point ⇒ Array<#===>
Set of Roby task matchers that describe where this data monitor should be attached.
-
#each_attachment_point {|element| ... } ⇒ Object
Enumerates all objects registered in attachment_point.
-
#each_monitor {|element| ... } ⇒ Object
Enumerates all objects registered in monitor.
- #find_monitor(name) ⇒ Object
- #find_through_method_missing(m, args) ⇒ Object
- #has_through_method_missing?(m) ⇒ Boolean
-
#monitor(name, *data_streams) ⇒ DataMonitor
Define a new data monitor.
-
#validate_monitors(monitors) ⇒ Object
Validate that the given monitors are proper definitions (i.e. that all their required parameters are set).
Instance Method Details
#all_attachment_point ⇒ Array<#===>
The union, along the class hierarchy, of all the values stored in attachment_point
20 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 20 inherited_attribute(:attachment_point, :attachment_points) { Array.new } |
#all_monitor ⇒ Array<DataMonitor>
The union, along the class hierarchy, of all the values stored in monitor
24 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 24 inherited_attribute(:monitor, :monitors) { Array.new } |
#apply_block(&block) ⇒ Object
60 61 62 63 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 60 def apply_block(&block) super validate_monitors(monitors) end |
#attach_to(query) ⇒ Object
Declares that this table should be attached to the tasks matching the given query
If none is defined, it is going to be attached to every instance of the root model (i.e. the table's root task model)
95 96 97 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 95 def attach_to(query) << query end |
#attachment_point ⇒ Array<#===>
Returns set of Roby task matchers that describe where this data monitor should be attached. They must obviously match the table's root task model
20 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 20 inherited_attribute(:attachment_point, :attachment_points) { Array.new } |
#each_attachment_point {|element| ... } ⇒ Object
Enumerates all objects registered in attachment_point
20 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 20 inherited_attribute(:attachment_point, :attachment_points) { Array.new } |
#each_monitor {|element| ... } ⇒ Object
Enumerates all objects registered in monitor
24 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 24 inherited_attribute(:monitor, :monitors) { Array.new } |
#find_monitor(name) ⇒ Object
79 80 81 82 83 84 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 79 def find_monitor(name) each_monitor do |m| return m if m.name == name end nil end |
#find_through_method_missing(m, args) ⇒ Object
104 105 106 107 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 104 def find_through_method_missing(m, args) MetaRuby::DSLs.find_through_method_missing( root, m, args, "_port".freeze => :find_port) || super end |
#has_through_method_missing?(m) ⇒ Boolean
99 100 101 102 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 99 def has_through_method_missing?(m) MetaRuby::DSLs.has_through_method_missing?( root, m, "_port".freeze => :has_port?) || super end |
#monitor(name, *data_streams) ⇒ DataMonitor
Define a new data monitor
Data monitors are objects that watch some data streams and either emit events and/or raise exceptions
24 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 24 inherited_attribute(:monitor, :monitors) { Array.new } |
#validate_monitors(monitors) ⇒ Object
Validate that the given monitors are proper definitions (i.e. that all their required parameters are set)
69 70 71 72 73 74 75 76 77 |
# File 'lib/syskit/coordination/models/data_monitoring_table.rb', line 69 def validate_monitors(monitors) monitors.each do |m| if !m.predicate raise InvalidDataMonitor.new(m), "#{m} has no associated predicate" elsif m.emitted_events.empty? && !m.raises? raise InvalidDataMonitor.new(m), "#{m} has no effect (it neither emits events nor generates an exception). You must either call #emit or #raise_exception on it" end end end |