Class: Roby::TaskMatcher::DRoby

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/distributed/protocol.rb

Overview

An intermediate representation of TaskMatcher objects suitable to be sent to our peers.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ DRoby

Returns a new instance of DRoby.



126
# File 'lib/roby/distributed/protocol.rb', line 126

def initialize(args); @args = args end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



125
126
127
# File 'lib/roby/distributed/protocol.rb', line 125

def args
  @args
end

Class Method Details

._load(str) ⇒ Object

:nodoc:



131
132
133
# File 'lib/roby/distributed/protocol.rb', line 131

def self._load(str) # :nodoc:
    setup_matcher(TaskMatcher.new, Marshal.load(str))
end

.setup_matcher(matcher, args) ⇒ Object

Common initialization of a TaskMatcher object from the given argument set. This is to be used by DRoby-dumped versions of subclasses of TaskMatcher.



138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/roby/distributed/protocol.rb', line 138

def self.setup_matcher(matcher, args)
    model, args, improves, needs, predicates, neg_predicates, owners = *args
    model  = model.proxy(nil) if model
    owners = owners.map { |peer| peer.proxy(nil) } if owners
    args   = args

    matcher = matcher.with_model(model).with_arguments(args || {}).
 which_improves(*improves).which_needs(*needs)
    matcher.predicates.merge(predicates)
    matcher.owners.concat(owners)
    matcher
end

Instance Method Details

#_dump(lvl) ⇒ Object

:nodoc:



127
128
129
# File 'lib/roby/distributed/protocol.rb', line 127

def _dump(lvl) # :nodoc:
    Marshal.dump(args) 
end