class Orocos::Async::AttributeBaseProxy
Attributes
raw_last_sample[R]
Public Class Methods
new(task_proxy,attribute_name,options=Hash.new)
click to toggle source
Calls superclass method
Orocos::Async::ObjectBase.new
# File lib/orocos/async/task_context_proxy.rb, line 15 def initialize(task_proxy,attribute_name,options=Hash.new) @type = options.delete(:type) @options = options super(attribute_name,task_proxy.event_loop) @task_proxy = task_proxy @raw_last_sample = nil end
Public Instance Methods
full_name()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 27 def full_name "#{task.name}.#{name}" end
last_sample()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 49 def last_sample Typelib.to_ruby(@raw_last_sample) if @raw_last_sample end
new_sample()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 45 def new_sample type.new end
on_change(policy = Hash.new,&block)
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 106 def on_change(policy = Hash.new,&block) @options = if policy.empty? @options elsif @options.empty? && !valid_delegator? policy elsif @options == policy @options else Orocos.warn "ProxyProperty #{full_name} cannot emit :change with different policies." Orocos.warn "The current policy is: #{@options}." Orocos.warn "Ignoring policy: #{policy}." @options end on_event :change,&block end
on_raw_change(policy = Hash.new,&block)
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 122 def on_raw_change(policy = Hash.new,&block) @options = if policy.empty? @options elsif @options.empty? && !valid_delegator? policy elsif @options == policy @options else Orocos.warn "ProxyProperty #{full_name} cannot emit :raw_change with different policies." Orocos.warn "The current policy is: #{@options}." Orocos.warn "Ignoring policy: #{policy}." @options end on_event :raw_change,&block end
period()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 72 def period if @options.has_key? :period @options[:period] else nil end end
period=(period)
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 80 def period=(period) @options[:period] = period @delegator_obj.period = period if valid_delegator? end
reachable!(attribute,options = Hash.new)
click to toggle source
Calls superclass method
Orocos::Async::ObjectBase#reachable!
# File lib/orocos/async/task_context_proxy.rb, line 53 def reachable!(attribute,options = Hash.new) @options = attribute.options if @type && @type != attribute.type && @type.name != attribute.orocos_type_name raise RuntimeError, "the given type #{@type} for attribute #{attribute.name} differes from the real type name #{attribute.type}" end @type = attribute.type remove_proxy_event(@delegator_obj,@delegator_obj.event_names) if valid_delegator? @raw_last_sample = attribute.raw_last_sample super(attribute,options) proxy_event(@delegator_obj,@delegator_obj.event_names-[:reachable]) rescue Orocos::NotFound unreachable! end
really_add_listener(listener)
click to toggle source
Calls superclass method
Orocos::Async::ObjectBase#really_add_listener
# File lib/orocos/async/task_context_proxy.rb, line 85 def really_add_listener(listener) return super unless listener.use_last_value? if listener.event == :change sample = last_sample if sample event_loop.once do listener.call sample end end elsif listener.event == :raw_change sample = raw_last_sample if sample event_loop.once do listener.call sample end end end super end
task()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 23 def task @task_proxy end
type()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 35 def type raise Orocos::NotFound, "#{self} is not reachable" unless @type @type end
type?()
click to toggle source
returns true if the proxy stored the type
# File lib/orocos/async/task_context_proxy.rb, line 41 def type? !!@type end
type_name()
click to toggle source
# File lib/orocos/async/task_context_proxy.rb, line 31 def type_name type.name end
unreachable!(options=Hash.new)
click to toggle source
Calls superclass method
Orocos::Async::ObjectBase#unreachable!
# File lib/orocos/async/task_context_proxy.rb, line 67 def unreachable!(options=Hash.new) remove_proxy_event(@delegator_obj,@delegator_obj.event_names) if valid_delegator? super(options) end