Class: Roby::TaskEventGenerator::DRoby
- Defined in:
- lib/roby/distributed/proxy.rb
Overview
An intermediate representation of TaskEventGenerator objects suitable to be sent to our peers.
Instance Attribute Summary collapse
-
#controlable ⇒ Object
readonly
True if the generator is controlable.
-
#happened ⇒ Object
readonly
True if the generator has already emitted once at the time TaskEventGenerator#droby_dump has been called.
-
#symbol ⇒ Object
readonly
The event name.
-
#task ⇒ Object
readonly
An object representing the task of this generator on our remote peer.
Instance Method Summary collapse
-
#initialize(controlable, happened, task, symbol) ⇒ 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. -
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(controlable, happened, task, symbol) ⇒ DRoby
Create a new DRoby object with the given information
175 176 177 178 179 180 |
# File 'lib/roby/distributed/proxy.rb', line 175 def initialize(controlable, happened, task, symbol) @controlable = controlable @happened = happened @task = task @symbol = symbol end |
Instance Attribute Details
#controlable ⇒ Object (readonly)
True if the generator is controlable
164 165 166 |
# File 'lib/roby/distributed/proxy.rb', line 164 def controlable @controlable end |
#happened ⇒ Object (readonly)
True if the generator has already emitted once at the time TaskEventGenerator#droby_dump has been called.
167 168 169 |
# File 'lib/roby/distributed/proxy.rb', line 167 def happened @happened end |
#symbol ⇒ Object (readonly)
The event name
172 173 174 |
# File 'lib/roby/distributed/proxy.rb', line 172 def symbol @symbol end |
#task ⇒ Object (readonly)
An object representing the task of this generator on our remote peer.
170 171 172 |
# File 'lib/roby/distributed/proxy.rb', line 170 def task @task end |
Instance Method Details
#proxy(peer) ⇒ Object
Create a new proxy which maps the object of peer represented by this communication intermediate.
192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/roby/distributed/proxy.rb', line 192 def proxy(peer) task = peer.local_object(self.task) unless task.has_event?(symbol) Roby::Distributed.debug { "ignoring #{self}: #{symbol} is not known on #{task}" } Roby::Distributed.ignore! end event = task.event(symbol) if happened && !event.happened? event.instance_eval { @happened = true } end event end |
#to_s ⇒ Object
:nodoc:
182 183 184 185 186 187 188 |
# File 'lib/roby/distributed/proxy.rb', line 182 def to_s # :nodoc: if task.respond_to?(:model) "#<dRoby:#{task.model.ancestors.first.first}/#{symbol}#{task.remote_siblings_to_s} task_arguments=#{task.arguments} plan=#{task.plan} owners=#{task.owners_to_s}>" else "#<dRoby:#{task}/#{symbol}>" end end |