class Orocos::Log::Property

Simulated Property based on a configuration log file It is automatically replayed if at least one OutputPort of the task is replayed

Attributes

name[R]

The property/attribute name

stream[R]

dedicated stream for simulating the port

task[R]

The underlying TaskContext instance

tracked[RW]

true –> this property shall be replayed

type[R]

The attribute type, as a subclass of Typelib::Type

type_name[R]

Public Class Methods

new(task, stream) click to toggle source
# File lib/orocos/log/task_context.rb, line 394
def initialize(task, stream)
    raise "Cannot create Property out of #{stream.class}" if !stream.instance_of?(Pocolog::DataStream)
    @stream = stream
    @name = stream.name.to_s.match(/\.(.*$)/)
    raise 'Stream name does not follow the convention TASKNAME.PROPERTYNAME' if @name == nil
    @name = @name[1]
    @type = stream.type
    @task = task
    @current_value = nil
    @type_name = stream.typename
end

Public Instance Methods

doc?() click to toggle source
# File lib/orocos/log/task_context.rb, line 406
def doc?
    false
end
full_name() click to toggle source

Give the full name for this property. It is the stream name.

# File lib/orocos/log/task_context.rb, line 438
def full_name
    stream.name
end
metadata() click to toggle source

returns the metadata associated with the underlying stream

# File lib/orocos/log/task_context.rb, line 447
def metadata
    stream.metadata
end
new_sample() click to toggle source
# File lib/orocos/log/task_context.rb, line 420
def new_sample
    type.new
end
number_of_samples() click to toggle source

Returns the number of samples for the property.

# File lib/orocos/log/task_context.rb, line 433
def number_of_samples
    return @stream.size
end
orocos_type_name() click to toggle source
# File lib/orocos/log/task_context.rb, line 424
def orocos_type_name
    if metadata && metadata.has_key?(:rock_orocos_type_name)
        metadata[:rock_orocos_type_name]
    else
        type_name
    end
end
read() click to toggle source

Read the current value of the property/attribute

# File lib/orocos/log/task_context.rb, line 411
def read
    @current_value
end
write(value) click to toggle source

Sets a new value for the property/attribute

# File lib/orocos/log/task_context.rb, line 416
def write(value)
    @current_value = value
end