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, 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.



1213
1214
1215
1216
1217
1218
# File 'lib/roby/execution_engine.rb', line 1213

def initialize(graph, object, origin, origin_neighbours, exception_handler)
    super(graph, object, origin, origin_neighbours)
    @exception_handler = exception_handler
    @handled_exceptions = []
    @unhandled_exceptions = []
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.



1211
1212
1213
# File 'lib/roby/execution_engine.rb', line 1211

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.



1211
1212
1213
# File 'lib/roby/execution_engine.rb', line 1211

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.



1211
1212
1213
# File 'lib/roby/execution_engine.rb', line 1211

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.



1229
1230
1231
# File 'lib/roby/execution_engine.rb', line 1229

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.



1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
# File 'lib/roby/execution_engine.rb', line 1233

def handle_examine_vertex(u)
    e = vertex_to_object.fetch(u)
    return unless 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.



1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/roby/execution_engine.rb', line 1220

def propagate_object(u, v, obj)
    raise if u == v

    unless obj.handled?
        obj.propagate(u, v)
        obj
    end
end