Module: Syskit::Coordination::PlanExtension

Defined in:
lib/syskit/coordination/plan_extension.rb

Defined Under Namespace

Classes: AttachedDataMonitoringTable

Instance Method Summary collapse

Instance Method Details

#data_monitoring_tablesSet<AttachedDataMonitoringTable>

Set of data monitoring tables attached to this plan

Returns:



27
# File 'lib/syskit/coordination/plan_extension.rb', line 27

attribute(:data_monitoring_tables) { Set.new }

#remove_data_monitoring_table(table) ⇒ void

This method returns an undefined value.

Removes a data monitoring table from this plan

Parameters:



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/syskit/coordination/plan_extension.rb', line 73

def remove_data_monitoring_table(table)
    if data_monitoring_tables.delete(table)
        table.triggers.each do |tr|
            remove_trigger(tr)
        end
        table.instances.each do |task, tbl|
            tbl.remove!
        end
    end
    nil
end

#use_data_monitoring_table(table_m, arguments = Hash.new) ⇒ Object

Activates the given DataMonitoringTable model on this plan

Instances of this table model will be attached to all tasks that match one of the table's attachment points (see Models::DataMonitoringTable#attach_to). If no attachment points have been given, every tasks matching the table's root model will be selected

Parameters:

  • table_m (Model<DataMonitoringTable>)

    the table model

  • arguments (Hash) (defaults to: Hash.new)

    the arguments that should be passed to the data monitoring tables

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/syskit/coordination/plan_extension.rb', line 42

def use_data_monitoring_table(table_m, arguments = Hash.new)
    # Verify that all required arguments are set, and that all
    # arguments are known
    arguments = table_m.validate_arguments(arguments)

    queries = table_m.each_attachment_point.to_a
    if queries.empty?
        queries << table_m.task_model.query.not_abstract
    end

    table_record = AttachedDataMonitoringTable.new table_m, arguments, Set.new, Hash.new
    queries.each do |query|
        trigger = add_trigger(query) do |task|
            if !table_record.instances.has_key?(task)
                task.when_finalized do |t|
                    table_record.instances.delete(task)
                end
                table_record.instances[task] = table_m.new(task, arguments)
            end
        end
        table_record.triggers << trigger
    end
    data_monitoring_tables << table_record
    table_record
end