Class: Orocos::OutputReader

Inherits:
RubyTasks::LocalInputPort show all
Defined in:
lib/orocos/output_reader.rb

Overview

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

Constant Summary

Constants inherited from RubyTasks::LocalInputPort

RubyTasks::LocalInputPort::NEW_DATA, RubyTasks::LocalInputPort::OLD_DATA

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RubyTasks::LocalInputPort

#clear, #do_clear, #do_read, #raw_read, #raw_read_new, #read_new_raw, #read_raw

Instance Attribute Details

#policyObject

The policy of the connection


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

def policy
  @policy
end

#portObject

The port this object is reading from


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

def port
  @port
end

Instance Method Details

#disconnectObject

Disconnects this port from the port it is reading


49
50
51
# File 'lib/orocos/output_reader.rb', line 49

def disconnect
    disconnect_all
end

#read(sample = nil) ⇒ Object

Reads a sample on the associated output port. Returns a value as soon as a sample has ever been written to the port since the data reader has been created

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

Raises:

  • (CORBA::ComError)

    if the remote process is known to be dead.


31
32
33
34
# File 'lib/orocos/output_reader.rb', line 31

def read(sample = nil)
    # Only overloaded for documentation reasons
    super
end

#read_helper(sample, copy_old_data) ⇒ Object

Helper method for #read and #read_new

This is overloaded in OutputReader to raise CORBA::ComError if the process supporting the remote task is known to be dead


14
15
16
17
18
19
20
21
22
# File 'lib/orocos/output_reader.rb', line 14

def read_helper(sample, copy_old_data)
	    if process = port.task.process
		if !process.alive?
		    disconnect_all
		    raise CORBA::ComError, "remote end is dead"
		end
	    end
    super
end

#read_new(sample = nil) ⇒ Object

Reads a sample on the associated output port, and returns nil if no new data is available

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

Raises:

  • (CORBA::ComError)

    if the remote process is known to be dead.

See Also:


43
44
45
46
# File 'lib/orocos/output_reader.rb', line 43

def read_new(sample = nil)
    # Only overloaded for documentation reasons
    super
end