Class: Roby::DRoby::V5::TaskDumper::DRoby
- Inherits:
-
PlanObjectDumper::DRoby
- Object
- DistributedObjectDumper::DRoby
- PlanObjectDumper::DRoby
- Roby::DRoby::V5::TaskDumper::DRoby
- Defined in:
- lib/roby/droby/v5/droby_dump.rb
Overview
An intermediate representation of Task objects suitable to be sent to our peers.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
The set of dRoby-formatted arguments.
-
#data ⇒ Object
readonly
The task's internal data.
-
#flags ⇒ Object
readonly
A set of boolean flags which describe the task's status.
Attributes inherited from PlanObjectDumper::DRoby
Attributes inherited from DistributedObjectDumper::DRoby
Instance Method Summary collapse
-
#initialize(remote_siblings, owners, model, plan_id, arguments, data, **flags) ⇒ DRoby
constructor
Create a new DRoby object with the given information.
-
#proxy(peer) ⇒ Object
Create a new proxy which maps the object of
peerrepresented by this communication intermediate. -
#update(peer, task, fresh_proxy: false) ⇒ Object
Updates an already existing proxy using the information contained in this object.
Methods inherited from PlanObjectDumper::DRoby
Constructor Details
#initialize(remote_siblings, owners, model, plan_id, arguments, data, **flags) ⇒ DRoby
Create a new DRoby object with the given information
534 535 536 537 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 534 def initialize(remote_siblings, owners, model, plan_id, arguments, data, **flags) super(remote_siblings, owners, model, plan_id) @arguments, @data, @flags = arguments, data, flags end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
The set of dRoby-formatted arguments
522 523 524 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 522 def arguments @arguments end |
#data ⇒ Object (readonly)
The task's internal data
524 525 526 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 524 def data @data end |
#flags ⇒ Object (readonly)
A set of boolean flags which describe the task's status. It is a symbol => bool flag where the following parameters are save:
- started
if the task has started
- finished
if the task has finished
- success
if the task has finished with success
- mission
if the task is a mission in its plan
531 532 533 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 531 def flags @flags end |
Instance Method Details
#proxy(peer) ⇒ Object
Create a new proxy which maps the object of peer represented by
this communication intermediate.
541 542 543 544 545 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 541 def proxy(peer) model = peer.local_object(self.model) arguments = peer.local_object(self.arguments) model.new(plan: local_plan(peer), **arguments) end |
#update(peer, task, fresh_proxy: false) ⇒ Object
Updates an already existing proxy using the information contained in this object.
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/roby/droby/v5/droby_dump.rb', line 549 def update(peer, task, fresh_proxy: false) super task.started = flags[:started] task.finished = flags[:finished] task.success = flags[:success] if task.mission? != flags[:mission] if flags[:mission] task.plan.add_mission_task(task) else task.plan.unmark_mission_task(task) end end unless fresh_proxy task.arguments.force_merge!(peer.local_object(arguments)) end task.instance_variable_set("@data", peer.local_object(data)) end |