Class: Roby::Query::DRoby

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

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plan_predicates, neg_plan_predicates, matcher) ⇒ DRoby

Returns a new instance of DRoby.



166
167
168
169
# File 'lib/roby/distributed/protocol.rb', line 166

def initialize(plan_predicates, neg_plan_predicates, matcher)
    @plan_predicates, @neg_plan_predicates, @matcher = 
 plan_predicates, neg_plan_predicates, matcher
end

Instance Attribute Details

#matcherObject (readonly)

:nodoc:



165
166
167
# File 'lib/roby/distributed/protocol.rb', line 165

def matcher
  @matcher
end

#neg_plan_predicatesObject (readonly)

:nodoc:



165
166
167
# File 'lib/roby/distributed/protocol.rb', line 165

def neg_plan_predicates
  @neg_plan_predicates
end

#plan_predicatesObject (readonly)

:nodoc:



165
166
167
# File 'lib/roby/distributed/protocol.rb', line 165

def plan_predicates
  @plan_predicates
end

Class Method Details

._load(str) ⇒ Object

:nodoc:



175
176
177
# File 'lib/roby/distributed/protocol.rb', line 175

def self._load(str) # :nodoc:
    DRoby.new(*Marshal.load(str))
end

Instance Method Details

#_dump(lvl) ⇒ Object

:nodoc:



171
172
173
# File 'lib/roby/distributed/protocol.rb', line 171

def _dump(lvl) # :nodoc:
    Marshal.dump([plan_predicates, neg_plan_predicates, matcher])
end

#proxy(peer) ⇒ Object



186
187
188
# File 'lib/roby/distributed/protocol.rb', line 186

def proxy(peer)
    to_query(peer.connection_space.plan)
end

#to_query(plan) ⇒ Object



179
180
181
182
183
184
# File 'lib/roby/distributed/protocol.rb', line 179

def to_query(plan)
    query = TaskMatcher::DRoby.setup_matcher(plan.find_tasks, matcher)
    query.plan_predicates.concat(plan_predicates)
    query.neg_plan_predicates.concat(neg_plan_predicates)
    query
end