Module: Orocos::TaskContext::StateReader

Defined in:
lib/orocos/task_context.rb

Overview

Specialization of the OutputReader to read the task'ss state port. Its read method will return a state in the form of a symbol. For instance, the RUNTIME_ERROR state is returned as :RUNTIME_ERROR

StateReader objects are created by TaskContext#state_reader

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#state_symbolsObject

Returns the value of attribute state_symbols



155
156
157
# File 'lib/orocos/task_context.rb', line 155

def state_symbols
  @state_symbols
end

Instance Method Details

#read(sample = nil) ⇒ Object



157
158
159
160
161
# File 'lib/orocos/task_context.rb', line 157

def read(sample = nil)
    if value = super(sample)
        @state_symbols[value]
    end
end

#read_new(sample = nil) ⇒ Object



163
164
165
166
167
# File 'lib/orocos/task_context.rb', line 163

def read_new(sample = nil)
    if value = super(sample)
        @state_symbols[value]
    end
end

#read_with_result(sample = nil, copy_old_data = false) ⇒ Object



169
170
171
172
173
174
175
176
# File 'lib/orocos/task_context.rb', line 169

def read_with_result(sample = nil, copy_old_data = false)
    result, value = super
    if value
        return result, @state_symbols[value]
    else
        return result
    end
end