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

java.lang.Object
  extended by org.omg.PortableServer.Servant
      extended by RTC.PortServicePOA
          extended by jp.go.aist.rtm.RTC.port.PortBase
              extended by jp.go.aist.rtm.RTC.port.InPortBase
All Implemented Interfaces:
SDOServiceOperations, org.omg.CORBA.portable.InvokeHandler, PortServiceOperations
Direct Known Subclasses:
InPort

public abstract class InPortBase
extends PortBase

Port for InPort

データ入力ポートの実装クラス。 This is an implementation class for the data input port.


Nested Class Summary
 
Nested classes/interfaces inherited from class jp.go.aist.rtm.RTC.port.PortBase
PortBase.connect_func, PortBase.disconnect_all_func, PortBase.disconnect_func, PortBase.find_conn_id, PortBase.find_interface, PortBase.find_port_ref
 
Field Summary
protected  java.util.Vector<InPortConnector> m_connectors
           
protected  java.util.Vector<java.lang.String> m_consumerTypes
           
protected  ConnectorListeners m_listeners
           
protected  Properties m_properties
           
protected  java.util.Vector<java.lang.String> m_providerTypes
           
protected  boolean m_singlebuffer
           
protected  BufferBase<org.omg.CORBA.portable.OutputStream> m_thebuffer
           
 
Fields inherited from class jp.go.aist.rtm.RTC.port.PortBase
m_connectionLimit, m_connectorsMutex, m_objref, m_onConnected, m_onConnectionLost, m_onDisconnected, m_onPublishInterfaces, m_onSubscribeInterfaces, m_onUnsubscribeInterfaces, m_ownerInstanceName, m_profile, m_profile_mutex, rtcout
 
Constructor Summary
InPortBase(java.lang.String name, java.lang.String data_type)
           Constructor
 
Method Summary
 void activateInterfaces()
           Activate all Port interfaces
 void addConnectorDataListener(int type, ConnectorDataListenerT listener)
           
 void addConnectorDataListener(int type, ConnectorDataListenerT listener, boolean autoclean)
           Adding BufferDataListener type listener
 void addConnectorListener(int type, ConnectorListener listener)
           
 void addConnectorListener(int type, ConnectorListener listener, boolean autoclean)
           Adding ConnectorListener type listener
 ReturnCode_t connect(ConnectorProfileHolder connector_profile)
           Connect the Port
 java.util.Vector<InPortConnector> connectors()
           Connector list
protected  InPortConnector createConnector(ConnectorProfileHolder cprof, Properties prop, InPortProvider provider)
           InPortPushConnector creation
protected  InPortConnector createConnector(ConnectorProfileHolder cprof, Properties prop, OutPortConsumer consumer)
           InPortPullConnector creation
protected  OutPortConsumer createConsumer(ConnectorProfileHolder cprof, Properties prop)
           InPort provider creation
protected  InPortProvider createProvider(ConnectorProfileHolder cprof, Properties prop)
           InPort provider creation
 void deactivateInterfaces()
           Deactivate all Port interfaces
 InPortConnector getConnectorById(java.lang.String id)
           Getting ConnectorProfile by ID
 InPortConnector getConnectorByName(java.lang.String name)
           Getting Connector by name
 java.util.Vector<java.lang.String> getConnectorIds()
           ConnectorId list
 java.util.Vector<java.lang.String> getConnectorNames()
           Connector name list
 boolean getConnectorProfileById(java.lang.String id, ConnectorBase.ConnectorInfoHolder prof)
           Getting ConnectorProfile by name
 boolean getConnectorProfileByName(java.lang.String name, ConnectorBase.ConnectorInfoHolder prof)
           Getting ConnectorProfile by name
 java.util.Vector<ConnectorBase.ConnectorInfo> getConnectorProfiles()
           ConnectorProfile list
 void init(Properties prop)
           Initializing properties
protected  void initConsumers()
           OutPort consumer initialization
protected  void initProviders()
           InPort provider initialization
 boolean isLittleEndian()
           Returns endian
 Properties properties()
           Get properties
protected  ReturnCode_t publishInterfaces(ConnectorProfileHolder cprof)
           Publish interface information
abstract  boolean read()
           It is a virtual method that is called from RTObject_impl::readAll().
 void removeConnectorDataListener(int type, ConnectorDataListenerT listener)
           Removing BufferDataListener type listener
 void removeConnectorListener(int type, ConnectorListener listener)
           Removing ConnectorListener type listener
protected  ReturnCode_t subscribeInterfaces(ConnectorProfileHolder cprof)
           Subscribe to the interface
protected  void unsubscribeInterfaces(ConnectorProfile connector_profile)
           Disconnect the interface connection
 
Methods inherited from class jp.go.aist.rtm.RTC.port.PortBase
_publishInterfaces, _this, addProperty, appendInterface, appendProperty, checkPorts, connectNext, deleteInterface, disconnect_all, disconnect, disconnectNext, eraseConnectorProfile, findConnProfile, findConnProfileIndex, get_connector_profile, get_connector_profiles, get_port_profile, getName, getPortProfile, getPortRef, getProfile, getUUID, isEmptyId, isExistingConnId, notify_connect, notify_disconnect, setConnectionLimit, setName, setOnConnected, setOnConnectionLost, setOnDisconnected, setOnPublishInterfaces, setOnSubscribeInterfaces, setOnUnsubscribeInterfaces, setOwner, setPortRef, setUUID, updateConnectorProfile, updateConnectors
 
Methods inherited from class RTC.PortServicePOA
_all_interfaces, _invoke, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_singlebuffer

protected boolean m_singlebuffer

m_thebuffer

protected BufferBase<org.omg.CORBA.portable.OutputStream> m_thebuffer

m_properties

protected Properties m_properties

m_providerTypes

protected java.util.Vector<java.lang.String> m_providerTypes

m_consumerTypes

protected java.util.Vector<java.lang.String> m_consumerTypes

m_connectors

protected java.util.Vector<InPortConnector> m_connectors

m_listeners

protected ConnectorListeners m_listeners
Constructor Detail

InPortBase

public InPortBase(java.lang.String name,
                  java.lang.String data_type)
Constructor

Parameters:
name - Port name
data_type - Specify the data type used in the InPort object.
Method Detail

properties

public Properties properties()
Get properties

This method gets properties in the port.

Returns:
Properties Properties

connectors

public final java.util.Vector<InPortConnector> connectors()
Connector list

This operation returns connector list

Returns:
connector list

getConnectorProfiles

public java.util.Vector<ConnectorBase.ConnectorInfo> getConnectorProfiles()
ConnectorProfile list

This operation returns ConnectorProfile list

Returns:
connector list

getConnectorIds

public java.util.Vector<java.lang.String> getConnectorIds()
ConnectorId list

This operation returns ConnectorId list

Returns:
Vector connector list

getConnectorNames

public java.util.Vector<java.lang.String> getConnectorNames()
Connector name list

This operation returns Connector name list

Returns:
Connector名のリスト Vector connector name list

getConnectorById

public InPortConnector getConnectorById(java.lang.String id)
Getting ConnectorProfile by ID

This operation returns Connector specified by ID.

Parameters:
id - Connector ID
Returns:
InPortConnector connector

getConnectorByName

public InPortConnector getConnectorByName(java.lang.String name)
Getting Connector by name

This operation returns Connector specified by name.

Parameters:
name - Connector ID
Returns:
InPortConnector connector

getConnectorProfileById

public boolean getConnectorProfileById(java.lang.String id,
                                       ConnectorBase.ConnectorInfoHolder prof)
Getting ConnectorProfile by name

This operation returns ConnectorProfile specified by name

Parameters:
id - Connector ID
prof - ConnectorProfileHolder
Returns:
false specified ID does not exist

getConnectorProfileByName

public boolean getConnectorProfileByName(java.lang.String name,
                                         ConnectorBase.ConnectorInfoHolder prof)
Getting ConnectorProfile by name

This operation returns ConnectorProfile specified by name

Parameters:
name - Connector ID
prof - ConnectorProfile
Returns:
false specified name does not exist

init

public void init(Properties prop)
Initializing properties

This method initializes the port in the specified property.

Parameters:
prop - Property for setting ports

read

public abstract boolean read()
It is a virtual method that is called from RTObject_impl::readAll().

This method reads out data from DataPort.

Returns:
true:Success,false:Failure

activateInterfaces

public void activateInterfaces()
Activate all Port interfaces

This operation activate all interfaces that is registered in the ports.

Specified by:
activateInterfaces in class PortBase

deactivateInterfaces

public void deactivateInterfaces()
Deactivate all Port interfaces

This operation deactivate all interfaces that is registered in the ports.

Specified by:
deactivateInterfaces in class PortBase

connect

public ReturnCode_t connect(ConnectorProfileHolder connector_profile)
Connect the Port

This operation establishes connection according to the given ConnectionProfile inforamtion. This function is premised on calling from mainly application program or tools. To establish the connection among Ports of RT-Components, application programs must call this operation giving ConnectorProfile with valid values as an argument. Out of ConnectorProfile member variables, "name", "ports" and "properties" members shall be set valid data. "connector_id" shall be set as empty string value or valid string UUID value. ConnectorProfile::name that is connection identifier shall be any valid CORBA::string. ConnectorProfile::connector_id shall be set unique identifier (usually UUID is used) for all connections. Since UUID string value is usually set in the connect() function, caller should just set empty string. If the connect() is called with the same UUID as existing connection, this function returns PRECONDITION_NOT_MET error. However, in order to update the existing connection profile, the "connect()" operation with existing connector ID might be used as valid method by future extension ConnectorProfile::ports, which is sequence of RTC::PortService references, shall store usually two or more ports' references. As exceptions, the "connect()" operation might be called with only one reference in ConnectorProfile, in case of just getting interfaces information from the port, or connecting a special port (i.e. the peer port except RTC::PortService on CORBA). ConnectorProfile::properties might be used to give certain properties to the service interfaces associated with the port. The properties is a sequence variable with a pair of key string and Any type value. Although the A variable can store any type of values, it is not recommended except string. The following is the summary of the ConnectorProfile member to be set when this operation is called.

connect() operation will call the first port in the sequence of the ConnectorProfile. "noify_connect()"s perform cascaded call to the ports stored in the ConnectorProfile::ports by order. Even if errors are raised by intermediate notify_connect() operation, as long as ports' object references are valid, it is guaranteed that this cascaded call is completed in all the ports. If invalid or dead ports exist in the port's sequence, the ports are skipped and notify_connect() is called for the next valid port. connect() function returns RTC_OK if all the notify_connect() return RTC_OK. At this time the connection is completed. If notify_connect()s return except RTC_OK, connect() calls disconnect() operation with the connector_id to destruct the connection, and then it returns error code from notify_connect(). The ConnectorProfile argument of the connect() operation returns ConnectorProfile::connector_id and various information about service interfaces that is published by publishInterfaces() in the halfway ports. The connect() and halfway notify_connect() functions never change ConnectorProfile::(name, ports)

Specified by:
connect in interface PortServiceOperations
Overrides:
connect in class PortBase
Parameters:
connector_profile - The ConnectorProfile.
Returns:
The return code of ReturnCode_t type.

publishInterfaces

protected ReturnCode_t publishInterfaces(ConnectorProfileHolder cprof)
Publish interface information

Publish interface information. Assign the Provider information that owned by this port to ConnectorProfile#properties


  dataport.dataflow_type
 

Specified by:
publishInterfaces in class PortBase
Parameters:
cprof - The connector profile
Returns:
The return code of ReturnCode_t type

subscribeInterfaces

protected ReturnCode_t subscribeInterfaces(ConnectorProfileHolder cprof)
Subscribe to the interface

Subscribe to interface. Derive Provider information that matches Consumer owned by the Port from ConnectorProfile#properties and set the Consumer to the reference of the CORBA object.

Specified by:
subscribeInterfaces in class PortBase
Parameters:
cprof - The connector profile
Returns:
ReturnCode_t The return code of ReturnCode_t type

unsubscribeInterfaces

protected void unsubscribeInterfaces(ConnectorProfile connector_profile)
Disconnect the interface connection

Disconnect the interface connection. Release all objects set in Consumer associated with given ConnectorProfile and unscribe the interface.

Specified by:
unsubscribeInterfaces in class PortBase
Parameters:
connector_profile - The connector profile

addConnectorDataListener

public void addConnectorDataListener(int type,
                                     ConnectorDataListenerT listener,
                                     boolean autoclean)
Adding BufferDataListener type listener

This operation adds certain listeners related to buffer writing and reading events. The following listener types are available.

Listeners should have the following function operator().

 ConnectorDataListener::
         operator()(const ConnectorProfile&, const cdrStream&)
 
The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorDataListener() function. If you want to keep ownership of the listener object, give "false" value to 3rd argument to inhibit automatic destruction.

Parameters:
type - listener_type A listener type
listener - A pointer to a listener object
autoclean - @param autoclean A flag for automatic listener destruction

addConnectorDataListener

public void addConnectorDataListener(int type,
                                     ConnectorDataListenerT listener)

removeConnectorDataListener

public void removeConnectorDataListener(int type,
                                        ConnectorDataListenerT listener)
Removing BufferDataListener type listener

[@.en This operation removes a specified listener.}

Parameters:
type - listener_type A listener type
listener - listener A pointer to a listener object

addConnectorListener

public void addConnectorListener(int type,
                                 ConnectorListener listener,
                                 boolean autoclean)
Adding ConnectorListener type listener

This operation adds certain listeners related to buffer writing and reading events. The following listener types are available.

Listeners should have the following function operator(). ConnectorListener::operator()(const ConnectorProfile&) The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorListener() function. If you want to keep ownership of the listener object, give "false" value to 3rd argument to inhibit automatic destruction.

Parameters:
type - A listener type
listener - A pointer to a listener object
autoclean - A flag for automatic listener destruction

addConnectorListener

public void addConnectorListener(int type,
                                 ConnectorListener listener)

removeConnectorListener

public void removeConnectorListener(int type,
                                    ConnectorListener listener)
Removing ConnectorListener type listener

This operation removes a specified listener.

Parameters:
type - A listener type
listener - A pointer to a listener object

initProviders

protected void initProviders()
InPort provider initialization


initConsumers

protected void initConsumers()
OutPort consumer initialization


createProvider

protected InPortProvider createProvider(ConnectorProfileHolder cprof,
                                        Properties prop)
InPort provider creation

InPortProvider is created, and information is published to ConnectorProfile.

Returns:
null is returned if failing in creation.

createConsumer

protected OutPortConsumer createConsumer(ConnectorProfileHolder cprof,
                                         Properties prop)
InPort provider creation

OutPortConsumer is created.

Returns:
null is returned if failing in creation.

createConnector

protected InPortConnector createConnector(ConnectorProfileHolder cprof,
                                          Properties prop,
                                          InPortProvider provider)
InPortPushConnector creation

Connector is created, preserves it in m_connectors.

Returns:
null is returned if failing in creation.

createConnector

protected InPortConnector createConnector(ConnectorProfileHolder cprof,
                                          Properties prop,
                                          OutPortConsumer consumer)
InPortPullConnector creation

Connector is created, preserves it in m_connectors.

Returns:
0 is returned if failing in creation.

isLittleEndian

public boolean isLittleEndian()
Returns endian

Returns:
Returns the endian setting.