Class: Orocos::InputWriter

Inherits:
RubyTasks::LocalOutputPort show all
Defined in:
lib/orocos/input_writer.rb

Overview

Local output port that is specifically designed to write to another task's input port

Constant Summary

Constants inherited from Port

Port::CONNECTION_POLICY_OPTIONS, Port::DEFAULT_CONNECTION_POLICY, Port::MQ_RTT_DEFAULT_QUEUE_LENGTH

Constants included from PortBase

PortBase::D_DIFFERENT_HOSTS, PortBase::D_SAME_HOST, PortBase::D_SAME_PROCESS, PortBase::D_UNKNOWN

Instance Attribute Summary collapse

Attributes included from PortBase

#model, #name, #orocos_type_name, #task, #type

Instance Method Summary collapse

Methods inherited from RubyTasks::LocalOutputPort

#connected?, #do_write, #remove

Methods inherited from OutputPort

#connect_to, #disconnect_from, #do_connect_to, #pretty_print, #publish_on_ros, reader_class, #to_async, #to_proxy, #unpublish_from_ros

Methods included from OutputPortBase

#connect_to, #disconnect_from, #reader

Methods inherited from Port

#connected?, #create_stream, #default_ros_topic_name, #disconnect_all, #do_create_stream, #do_disconnect_all, #do_disconnect_from, #do_remove_stream, #doc, #doc?, #handle_mq_transport, prepare_policy, #pretty_print, #refine_exceptions, #remove_stream, #to_orocos_port, transient_local_port_name, transport_name, #type_name, validate_policy

Methods included from PortBase

#==, #distance_to, #ensure_type_available, #full_name, #initialize, #log_metadata, #max_marshalling_size, #max_sizes, #new_sample, #to_s

Instance Attribute Details

#policyObject

The policy of the connection



8
9
10
# File 'lib/orocos/input_writer.rb', line 8

def policy
  @policy
end

#portObject

The port this object is reading from



5
6
7
# File 'lib/orocos/input_writer.rb', line 5

def port
  @port
end

Instance Method Details

#disconnectObject

Disconnects this port from the port it is reading



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

def disconnect
    disconnect_all
end

#write(data) ⇒ Object

Write data on the associated input port

This is only possible if the remote deployment has been started by this Ruby instance

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/orocos/input_writer.rb', line 20

def write(data)
	    if process = port.task.process
		if !process.alive?
		    disconnect_all
		    raise CORBA::ComError, "remote end is dead"
		end
	    end
    if !super
        raise CORBA::ComError, "remote end was disconnected"
    else true
    end
end