Class: Roby::RemoteInterface

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

Overview

RemoteInterface objects are used as local representation of remote interface objects. They offer a seamless interface to a remotely running Roby controller.

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ RemoteInterface

Create a RemoteInterface object for the remote object represented by interface, where interface is a DRbObject for a remote Interface object.



89
90
91
# File 'lib/roby/interface.rb', line 89

def initialize(interface)
    @interface = interface
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object

:nodoc:



133
134
135
136
137
138
139
140
141
142
# File 'lib/roby/interface.rb', line 133

def method_missing(m, *args) # :nodoc:
    result = @interface.send(m, *args)
    if result.kind_of?(RemoteObjectProxy)
  result.remote_interface = @interface
    end
    result

rescue Exception => e
    raise e, e.message, Roby.filter_backtrace(e.backtrace)
end

Instance Method Details

#find_tasks(model = nil, args = nil) ⇒ Object

Returns a Query object which can be used to interactively query the running plan



95
96
97
98
99
100
101
# File 'lib/roby/interface.rb', line 95

def find_tasks(model = nil, args = nil)
    q = Query.new(self)
    if model
  q.which_fullfills(model, args)
    end
    q
end

#instance_methods(include_super = false) ⇒ Object

:nodoc:



127
128
129
130
# File 'lib/roby/interface.rb', line 127

def instance_methods(include_super = false) # :nodoc:
    Interface.instance_methods(false).
  actions.map { |name| "#{name}!" }
end

#query_each(result_set) ⇒ Object

Defined for remotes queries to work



110
111
112
113
114
# File 'lib/roby/interface.rb', line 110

def query_each(result_set) # :nodoc:
    result_set.each do |t|
  yield(t)
    end
end

#query_result_set(query) ⇒ Object

Defined for remotes queries to work



104
105
106
107
108
# File 'lib/roby/interface.rb', line 104

def query_result_set(query) # :nodoc:
    @interface.remote_query_result_set(Distributed.format(query)).each do |t|
  t.remote_interface = self
    end
end

#query_roots(result_set, relation) ⇒ Object

Defined for remotes queries to work



116
117
118
119
120
# File 'lib/roby/interface.rb', line 116

def query_roots(result_set, relation) # :nodoc:
    @interface.remote_query_roots(result_set, Distributed.format(relation)).each do |t|
  t.remote_interface = self
    end
end

#stateObject

Returns the DRbObject for the remote controller state object



123
124
125
# File 'lib/roby/interface.rb', line 123

def state
    remote_constant('State')
end