Class: Orocos::RubyTasks::RemoteTaskContext

Inherits:
TaskContext show all
Defined in:
lib/orocos/ruby_tasks/remote_task_context.rb

Overview

Facade that hides a ruby task behind an object that behaves exactly like a plain TaskContext

It is to be used in tests where it is more convenient to use RubyTasks (rather than compile orogen components), but where we want to be sure to only have access to the plain TaskContext API

It only replicates the creation and destruction APIs from TaskContext

Constant Summary

Constants inherited from TaskContextBase

TaskContextBase::RUNNING_STATES

Constants included from Namespace

Namespace::DELIMATOR

Instance Attribute Summary collapse

Attributes inherited from TaskContext

#logger

Attributes inherited from TaskContextBase

#attributes, #configuration_log, #current_state, #ior, #process, #properties, #state_symbols

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TaskContext

#==, #apply_conf, #apply_conf_file, #attribute, #attribute_names, #callop, #cleanup, #configure, #connect_to, corba_wrap, #create_property_log_stream, #disconnect_from, #do_attribute_names, #do_attribute_read, #do_attribute_read_string, #do_attribute_type_name, #do_attribute_write, #do_attribute_write_string, #do_cleanup, #do_configure, #do_has_operation?, #do_has_port?, #do_operation_call, #do_operation_names, #do_operation_send, #do_port, #do_port_names, #do_property_names, #do_property_read, #do_property_read_string, #do_property_type_name, #do_property_write, #do_property_write_string, #do_real_name, #do_reset_exception, #do_start, #do_state, #do_stop, #has_operation?, #has_port?, #initialize, #log_all_configuration, #log_all_ports, #model, new, #operation, #operation_argument_types, #operation_names, #operation_return_types, #peek_state, #ping, #port, #port_names, #property, #property_names, #raw_port, #raw_property, #reset_exception, #resolve_connection_from, #resolve_disconnection_from, #rtt_state, #save_conf, #sendop, #start, #state_reader, state_transition_call, #stop, #tid, #to_async, #to_proxy, #to_s, #wait_for_state

Methods inherited from TaskContextBase

#add_default_states, #available_states, #basename, connect_to, #connect_to, #doc, #doc?, #each_attribute, #each_input_port, #each_operation, #each_output_port, #each_port, #each_property, #error?, #error_state?, #exception?, #exception_state?, #fatal_error?, #fatal_error_state?, find_one_running, get, get_provides, #has_attribute?, #has_operation?, #has_port?, #has_property?, #implements?, #info, #initialize, #input_port, #input_port_model, #inspect, #method_missing, #model, #model=, #name, #on_localhost?, #output_port, #output_port_model, #peek_current_state, #peek_state, #ports, #pre_operational?, #pretty_print, reachable?, #reachable?, #ready?, #running?, #runtime_error?, #runtime_state?, #state, #state_changed?, #states, #to_h, #to_s, #toplevel_state

Methods included from Namespace

#basename, #map_to_namespace, #namespace, #namespace=, #same_namespace?, #split_name, split_name, validate_namespace_name, #verify_same_namespace

Methods included from PortsSearchable

#find_all_input_ports, #find_all_output_ports, #find_all_ports, #find_input_port, #find_output_port, #find_port

Methods included from TaskContextBaseAbstract

#attribute, #attribute_names, #operation, #operation_names, #ping, #port, #port_names, #property, #property_names, #rtt_state

Constructor Details

This class inherits a constructor from Orocos::TaskContext

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Orocos::TaskContextBase

Instance Attribute Details

#local_ruby_taskObject (readonly)

The underlying TaskContext



22
23
24
# File 'lib/orocos/ruby_tasks/remote_task_context.rb', line 22

def local_ruby_task
  @local_ruby_task
end

Class Method Details

.from_orogen_model(name, orogen_model) ⇒ Object

Create a Orocos::RubyTasks::RemoteTaskContext based on its orogen model



14
15
16
17
18
19
# File 'lib/orocos/ruby_tasks/remote_task_context.rb', line 14

def self.from_orogen_model(name, orogen_model)
    ruby_task = TaskContext.from_orogen_model(name, orogen_model)
    remote_task = new(ruby_task.ior, name: ruby_task.name, model: ruby_task.model)
    remote_task.instance_variable_set(:@local_ruby_task, ruby_task)
    remote_task
end

Instance Method Details

#disposeObject

Destroys a created ruby task



25
26
27
# File 'lib/orocos/ruby_tasks/remote_task_context.rb', line 25

def dispose
    @local_ruby_task.dispose
end