Class: Roby::ExecutionEngine::ExceptionPropagationVisitor Private

Inherits:
Relations::ForkMergeVisitor show all
Defined in:
lib/roby/execution_engine.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Graph visitor that propagates exceptions in the dependency graph

Instance Attribute Summary collapse

Attributes inherited from Relations::ForkMergeVisitor

#in_degree, #origin, #origin_neighbours, #out_degree, #pending_merges, #vertex_to_object

Instance Method Summary collapse

Methods inherited from Relations::ForkMergeVisitor

#compute_in_out_degrees, #follow_edge?, #handle_back_edge, #handle_forward_edge, #handle_tree_edge, #visit

Constructor Details

#initialize(graph, object, origin, origin_neighbours = graph.out_neighbours(origin), &exception_handler) ⇒ ExceptionPropagationVisitor

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExceptionPropagationVisitor.



1134
1135
1136
1137
1138
1139
# File 'lib/roby/execution_engine.rb', line 1134

def initialize(graph, object, origin, origin_neighbours = graph.out_neighbours(origin), &exception_handler)
    super(graph, object, origin, origin_neighbours)
    @exception_handler = exception_handler
    @handled_exceptions = Array.new
    @unhandled_exceptions = Array.new
end

Instance Attribute Details

#exception_handlerObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1130
1131
1132
# File 'lib/roby/execution_engine.rb', line 1130

def exception_handler
  @exception_handler
end

#handled_exceptionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1131
1132
1133
# File 'lib/roby/execution_engine.rb', line 1131

def handled_exceptions
  @handled_exceptions
end

#unhandled_exceptionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1132
1133
1134
# File 'lib/roby/execution_engine.rb', line 1132

def unhandled_exceptions
  @unhandled_exceptions
end

Instance Method Details

#fork_object(obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1149
1150
1151
# File 'lib/roby/execution_engine.rb', line 1149

def fork_object(obj)
    obj.fork
end

#handle_examine_vertex(u) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
# File 'lib/roby/execution_engine.rb', line 1153

def handle_examine_vertex(u)
    e = vertex_to_object.fetch(u)
    return if !e

    if e.handled = exception_handler[e, u]
        handled_exceptions << e
    elsif out_degree[u] == 0
        unhandled_exceptions << e
    end
end

#propagate_object(u, v, obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1141
1142
1143
1144
1145
1146
1147
# File 'lib/roby/execution_engine.rb', line 1141

def propagate_object(u, v, obj)
    raise if u == v
    if !obj.handled?
        obj.propagate(u, v)
        obj
    end
end