class Orocos::OutputReader

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

Attributes

policy[RW]

The policy of the connection

port[RW]

The port this object is reading from

Public Instance Methods

disconnect() click to toggle source

Disconnects this port from the port it is reading

# File lib/orocos/output_reader.rb, line 61
def disconnect
    disconnect_all
end
read(sample = nil) click to toggle source

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

@raise [CORBA::ComError] if the remote process is known to be dead. This is only possible if the remote deployment has been started by this Ruby instance

Calls superclass method Orocos::RubyTasks::LocalInputPort#read
# File lib/orocos/output_reader.rb, line 31
def read(sample = nil)
    if !policy[:pull]
        Orocos.allow_blocking_calls do
            # Non-pull readers are non-blocking
            super
        end
    else
        super
    end
end
read_helper(sample, copy_old_data) click to toggle source

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

Calls superclass method
# 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) click to toggle source

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

@raise [CORBA::ComError] if the remote process is known to be dead. This is only possible if the remote deployment has been started by this Ruby instance @see read

# File lib/orocos/output_reader.rb, line 49
def read_new(sample = nil)
    if !policy[:pull]
        Orocos.allow_blocking_calls do
            # Non-pull readers are non-blocking
            super
        end
    else
        super
    end
end