class Orocos::Async::Log::AttributeBase

Attributes

raw_last_sample[R]

Public Class Methods

new(async_task,attribute,options=Hash.new) click to toggle source
Calls superclass method Orocos::Async::ObjectBase.new
# File lib/orocos/async/log/attributes.rb, line 12
def initialize(async_task,attribute,options=Hash.new)
    super(attribute.name,async_task.event_loop)
    @task = async_task
    @raw_last_sample = attribute.raw_read
    # do not queue reachable event no listeners are registered so far
    disable_emitting do 
        reachable!(attribute)
    end
    attribute.notify do
        @raw_last_sample = attribute.raw_read
        emit_raw_change @raw_last_sample
        emit_change Typelib.to_ruby(@raw_last_sample)
    end
end

Public Instance Methods

last_sample() click to toggle source
# File lib/orocos/async/log/attributes.rb, line 27
def last_sample
    if @raw_last_sample
        Typelib.to_ruby(@raw_last_sample)
    end
end
really_add_listener(listener) click to toggle source
# File lib/orocos/async/log/attributes.rb, line 33
def really_add_listener(listener)
    return super unless listener.use_last_value?

    if listener.event == :change && @raw_last_sample
        event_loop.once{listener.call(Typelib.to_ruby(@raw_last_sample))}
    elsif listener.event == :raw_change && @raw_last_sample
        event_loop.once{listener.call(@raw_last_sample)}
    end
    super
end
type?() click to toggle source
# File lib/orocos/async/log/attributes.rb, line 44
def type?
    true
end