Class: Orocos::TaskContextAttribute

Inherits:
AttributeBase show all
Defined in:
lib/orocos/task_context.rb

Direct Known Subclasses

Attribute, Property

Instance Attribute Summary collapse

Attributes inherited from AttributeBase

#log_port, #log_stream, #name, #orocos_type_name, #task, #type

Instance Method Summary collapse

Methods inherited from AttributeBase

#==, #doc, #doc?, #ensure_type_available, #full_name, #log_current_value, #log_metadata, #log_value, #new_sample, #pretty_print, #raw_read, #read, #type_name, #write

Constructor Details

#initialize(task, name, orocos_type_name) ⇒ TaskContextAttribute

Returns a new instance of TaskContextAttribute.


15
16
17
18
19
20
# File 'lib/orocos/task_context.rb', line 15

def initialize(task, name, orocos_type_name)
    super
    if task.has_operation?(opname = "__orogen_set#{name.capitalize}")
        @dynamic_operation = task.operation(opname)
    end
end

Instance Attribute Details

#dynamic_operationObject (readonly)

Returns the operation that has to be called if this is an dynamic propery. Nil otherwise


11
12
13
# File 'lib/orocos/task_context.rb', line 11

def dynamic_operation
  @dynamic_operation
end

Instance Method Details

#do_write_dynamic(value) ⇒ Object


22
23
24
25
26
# File 'lib/orocos/task_context.rb', line 22

def do_write_dynamic(value)
    if !@dynamic_operation.callop(value)
        raise PropertyChangeRejected, "the change of property #{name} was rejected by the remote task"
    end
end

#dynamic?Boolean

Returns:

  • (Boolean)

13
# File 'lib/orocos/task_context.rb', line 13

def dynamic?; !!@dynamic_operation end