jp.go.aist.rtm.RTC.port
Class InPortPullConnector

java.lang.Object
  extended by jp.go.aist.rtm.RTC.port.ConnectorBase
      extended by jp.go.aist.rtm.RTC.port.InPortConnector
          extended by jp.go.aist.rtm.RTC.port.InPortPullConnector

public class InPortPullConnector
extends InPortConnector

InPortPullConnector class

Connector class of InPort for pull type dataflow. When "pull" is specified as dataflow_type at the time of establishing connection, this object is generated and owned by the InPort. This connector and InPortPullConnector make a pair and realize pull type dataflow of data ports. One connector corresponds to one connection which provides a data stream. Connector is distinguished by ID of the UUID that is generated at establishing connection. InPortPullConnector owns and manages the following objects.

Data written into the OutPort is passed to the OutPortPullConnector::write(), and is written into the buffer. Consequently, InPort::read() and InPortPullConnector::read() call OutPortConsumer::get(), and it reads data from the buffer of OutPortPullConnector. Finally data would be written into the InPortPullConnector's buffer.


Nested Class Summary
 
Nested classes/interfaces inherited from class jp.go.aist.rtm.RTC.port.ConnectorBase
ConnectorBase.ConnectorInfo, ConnectorBase.ConnectorInfoHolder
 
Field Summary
 
Fields inherited from class jp.go.aist.rtm.RTC.port.InPortConnector
m_buffer, m_isLittleEndian, m_orb, m_profile, m_spi_orb
 
Constructor Summary
InPortPullConnector(ConnectorBase.ConnectorInfo profile, OutPortConsumer consumer, ConnectorListeners listeners, BufferBase<org.omg.CORBA.portable.OutputStream> buffer)
           Constructor.
 
Method Summary
 void activate()
           Connector activation
protected  BufferBase<org.omg.CORBA.portable.OutputStream> createBuffer(ConnectorBase.ConnectorInfo profile)
           create buffer
 void deactivate()
           Connector deactivation
 ReturnCode disconnect()
           Disconnect connection
protected  void onConnect()
           Invoke callback when connection is established
protected  void onDisconnect()
           Invoke callback when connection is destroied
 ReturnCode read(DataRef<org.omg.CORBA.portable.InputStream> data)
           Reading data
 void setListener(ConnectorBase.ConnectorInfo profile, ConnectorListeners listeners)
           Set the listener.
 
Methods inherited from class jp.go.aist.rtm.RTC.port.InPortConnector
getBuffer, id, isLittleEndian, name, profile, setEndian
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InPortPullConnector

public InPortPullConnector(ConnectorBase.ConnectorInfo profile,
                           OutPortConsumer consumer,
                           ConnectorListeners listeners,
                           BufferBase<org.omg.CORBA.portable.OutputStream> buffer)
                    throws java.lang.Exception
Constructor.

InPortPullConnector's constructor is given the following arguments. According to ConnectorInfo which includes connection information, a buffer is created. It is also given a pointer to the consumer object for the OutPort interface. The owner-ship of the pointer is owned by this OutPortPullConnector, it has responsibility to destruct the OutPortConsumer. OutPortPullConnector also has ConnectorListeners to provide event callback mechanisms, and they would be called at the proper timing. If data buffer is given by OutPortBase, the pointer to the buffer is also given as arguments.

Parameters:
profile - ConnectorInfo
consumer - consumer OutPortConsumer
listeners - ConnectorListeners type lsitener object list
buffer - CdrBufferBase type buffer
Throws:
java.lang.Exception
Method Detail

read

public ReturnCode read(DataRef<org.omg.CORBA.portable.InputStream> data)
Reading data

This function get data from OutPortConsumer. If data is read properly, this function will return PORT_OK return code. Except normal return, BUFFER_EMPTY, TIMEOUT, PRECONDITION_NOT_MET and PORT_ERROR will be returned as error codes.

Specified by:
read in class InPortConnector
Returns:
PORT_OK Normal return BUFFER_EMPTY Buffer empty TIMEOUT Timeout PRECONDITION_NOT_MET Preconditin not met PORT_ERROR Other error

disconnect

public ReturnCode disconnect()
Disconnect connection

This operation disconnect this connection

Specified by:
disconnect in class InPortConnector
Returns:
ReturnCode

activate

public void activate()
Connector activation

This operation activates this connector

Specified by:
activate in class ConnectorBase

deactivate

public void deactivate()
Connector deactivation

This operation deactivates this connector

Specified by:
deactivate in class ConnectorBase

createBuffer

protected BufferBase<org.omg.CORBA.portable.OutputStream> createBuffer(ConnectorBase.ConnectorInfo profile)
create buffer

This function creates a buffer based on given information.

Parameters:
profile - Connector information
Returns:
The poitner to the buffer

onConnect

protected void onConnect()
Invoke callback when connection is established


onDisconnect

protected void onDisconnect()
Invoke callback when connection is destroied


setListener

public void setListener(ConnectorBase.ConnectorInfo profile,
                        ConnectorListeners listeners)
Set the listener.

InPort provides callback functionality that calls specific listener objects according to the events in the data publishing process. For details, see documentation of ConnectorDataListener class and ConnectorListener class in ConnectorListener.h. In this InPortCorbaCdrProvider provides the following callbacks.

Specified by:
setListener in class InPortConnector
Parameters:
profile - Connector information
listeners - Listener objects