Module: Syskit::Coordination::Models::FaultResponseTableExtension
- Extended by:
- MetaRuby::Attributes
- Includes:
- MetaRuby::DSLs::FindThroughMethodMissing
- Defined in:
- lib/syskit/coordination/models/fault_response_table_extension.rb
Overview
Module providing the methods necessary to easily use the data monitoring tables within a fault response table
Defined Under Namespace
Classes: UsedDataMonitoringTable
Instance Method Summary collapse
-
#all_data_monitoring_table ⇒ Array<Object>
The union, along the class hierarchy, of all the values stored in data_monitoring_table.
- #data_monitoring_table(&block) ⇒ Model<Coordination::DataMonitoringTable>
-
#each_data_monitoring_table {|element| ... } ⇒ Object
Enumerates all objects registered in data_monitoring_table.
-
#find_monitor(name) ⇒ Model<Coordination::DataMonitor>?
Find a data monitor by its name.
- #find_through_method_missing(m, args) ⇒ Object
- #has_through_method_missing?(m) ⇒ Boolean
- #method_missing(m, *args, &block) ⇒ Object
- #respond_to_missing?(m, include_private) ⇒ Boolean
-
#use_data_monitoring_table(table, arguments = Hash.new) ⇒ Object
Attach a data monitoring table on this fault response table.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 94 def method_missing(m, *args, &block) if arg = arguments[m] return Roby::Coordination::Models::Variable.new(m) else super end end |
Instance Method Details
#all_data_monitoring_table ⇒ Array<Object>
The union, along the class hierarchy, of all the values stored in data_monitoring_table
12 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 12 inherited_attribute(:data_monitoring_table, :data_monitoring_tables) { Array.new } |
#data_monitoring_table({ root root_model; ... }) ⇒ Model<Coordination::DataMonitoringTable> #data_monitoring_table ⇒ Model<Coordination::DataMonitoringTable>
12 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 12 inherited_attribute(:data_monitoring_table, :data_monitoring_tables) { Array.new } |
#each_data_monitoring_table {|element| ... } ⇒ Object
Enumerates all objects registered in data_monitoring_table
12 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 12 inherited_attribute(:data_monitoring_table, :data_monitoring_tables) { Array.new } |
#find_monitor(name) ⇒ Model<Coordination::DataMonitor>?
Find a data monitor by its name
It searches for all used data monitoring tables and returns the first monitor that has the given name
69 70 71 72 73 74 75 76 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 69 def find_monitor(name) each_data_monitoring_table do |tbl| if m = tbl.table.find_monitor(name) return m end end nil end |
#find_through_method_missing(m, args) ⇒ Object
83 84 85 86 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 83 def find_through_method_missing(m, args) MetaRuby::DSLs.find_through_method_missing( self, m, args, "_monitor".freeze => :find_monitor) || super end |
#has_through_method_missing?(m) ⇒ Boolean
78 79 80 81 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 78 def has_through_method_missing?(m) MetaRuby::DSLs.has_through_method_missing?( self, m, "_monitor".freeze => :find_monitor) || super end |
#respond_to_missing?(m, include_private) ⇒ Boolean
90 91 92 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 90 def respond_to_missing?(m, include_private) arguments[m] || super end |
#use_data_monitoring_table(table, arguments = Hash.new) ⇒ Object
Attach a data monitoring table on this fault response table
51 52 53 54 55 56 57 58 59 |
# File 'lib/syskit/coordination/models/fault_response_table_extension.rb', line 51 def use_data_monitoring_table(table, arguments = Hash.new) table.each_argument do |_, arg| if arg.required && !arguments[arg.name] raise ArgumentError, "#{table} requires an argument called #{arg.name}" end end data_monitoring_tables << UsedDataMonitoringTable.new(table, arguments) self end |