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.



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

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.



1209
1210
1211
# File 'lib/roby/execution_engine.rb', line 1209

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.



1209
1210
1211
# File 'lib/roby/execution_engine.rb', line 1209

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.



1209
1210
1211
# File 'lib/roby/execution_engine.rb', line 1209

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.



1227
1228
1229
# File 'lib/roby/execution_engine.rb', line 1227

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.



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

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.



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

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

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