Class: Roby::Parallel
- Inherits:
-
TaskAggregator
- Object
- BasicObject
- PlanObject
- Task
- TaskAggregator
- Roby::Parallel
- Defined in:
- lib/roby/task-operations.rb
Constant Summary
Constants included from Log::TaskHooks
Constants included from Log::BasicObjectHooks
Instance Attribute Summary collapse
-
#children_success ⇒ Object
readonly
Returns the value of attribute children_success.
Attributes inherited from TaskAggregator
Attributes inherited from PlanObject
#executable, #plan, #removed_at
Attributes inherited from BasicObject
Instance Method Summary collapse
- #<<(task) ⇒ Object
-
#initialize(arguments = {}) ⇒ Parallel
constructor
A new instance of Parallel.
- #name ⇒ Object
- #to_parallel ⇒ Object
- #to_task(task = nil) ⇒ Object
Methods inherited from TaskAggregator
Methods inherited from Task
#_dump, _load, #droby_dump, improves, #improves?, improves?, match, needs, #needs?, needs?
Methods included from TaskStructure::ModelConflicts
#conflicts_with, #conflicts_with?
Methods included from Distributed::DRobyTaskModel::Dump
Methods included from Distributed::DRobyModel::Dump
Methods included from Distributed::TaskNotifications
Methods included from TaskOperations
Methods included from Log::TaskHooks
#added_child_object, #removed_child_object
Methods inherited from PlanObject
#add_child_object, #apply_relation_changes, child_plan_object, #each_plan_child, #executable?, #finalized?, #forget_peer, #read_write?, #remotely_useful?, #removing_child_object, #replace_by, #replace_subplan_by, #root_object, #root_object?, #subscribed?, #update_on?, #updated_by?
Methods included from Distributed::RelationModificationHooks
#added_child_object, #removed_child_object
Methods included from Transactions::PlanObjectUpdates
#adding_child_object, #removing_child_object
Methods included from DirectedRelationSupport
#add_child_object, #add_parent_object, #check_is_relation, #related_objects, #relations, #remove_child_object, #remove_children, #remove_parent_object, #remove_parents, #remove_relations
Methods inherited from BasicObject
#add_sibling_for, #distribute?, distribute?, #finalized?, #forget_peer, #has_sibling_on?, #initialize_copy, local_only, #read_write?, #remotely_useful?, #remove_sibling_for, #self_owned?, #sibling_of, #sibling_on, #subscribe, #subscribed?, #update_on?, #updated?, #updated_by?, #updated_peers
Methods included from Log::BasicObjectHooks
Constructor Details
#initialize(arguments = {}) ⇒ Parallel
Returns a new instance of Parallel.
120 121 122 123 124 125 |
# File 'lib/roby/task-operations.rb', line 120 def initialize(arguments = {}) super @children_success = Roby::AndGenerator.new @children_success.forward event(:success) end |
Instance Attribute Details
#children_success ⇒ Object (readonly)
Returns the value of attribute children_success.
119 120 121 |
# File 'lib/roby/task-operations.rb', line 119 def children_success @children_success end |
Instance Method Details
#<<(task) ⇒ Object
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/roby/task-operations.rb', line 142 def <<(task) raise "trying to change a running parallel task" if running? @tasks << task on(:start, task, :start) realized_by task children_success << task.event(:success) self end |
#name ⇒ Object
115 116 117 |
# File 'lib/roby/task-operations.rb', line 115 def name @name || @tasks.map { |t| t.name }.join("|") end |
#to_parallel ⇒ Object
153 |
# File 'lib/roby/task-operations.rb', line 153 def to_parallel; self end |
#to_task(task = nil) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/roby/task-operations.rb', line 127 def to_task(task = nil) return super() unless task task = task.new unless task.kind_of?(Roby::Task) @tasks.each do |t| task.realized_by t task.on(:start, t, :start) end task.event(:success).emit_on children_success delete task end |