Class: Orocos::TaskContextAttribute
- Inherits:
-
AttributeBase
- Object
- AttributeBase
- Orocos::TaskContextAttribute
- Defined in:
- lib/orocos/task_context.rb
Instance Attribute Summary collapse
-
#dynamic_operation ⇒ Object
readonly
Returns the operation that has to be called if this is an dynamic propery.
Attributes inherited from AttributeBase
#log_port, #log_stream, #name, #orocos_type_name, #task, #type
Instance Method Summary collapse
- #do_write_dynamic(value) ⇒ Object
- #dynamic? ⇒ Boolean
-
#initialize(task, name, orocos_type_name) ⇒ TaskContextAttribute
constructor
A new instance of TaskContextAttribute.
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_operation ⇒ Object (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
13 |
# File 'lib/orocos/task_context.rb', line 13 def dynamic?; !!@dynamic_operation end |