jp.go.aist.rtm.RTC.port
クラス PortBase

java.lang.Object
  上位を拡張 org.omg.PortableServer.Servant
      上位を拡張 RTC.PortServicePOA
          上位を拡張 jp.go.aist.rtm.RTC.port.PortBase
すべての実装されたインタフェース:
SDOServiceOperations, org.omg.CORBA.portable.InvokeHandler, PortServiceOperations
直系の既知のサブクラス:
CorbaPort, InPortBase, OutPortBase

public abstract class PortBase
extends PortServicePOA

Port の基底クラス

RTC::Port の基底となるクラス。 RTC::Port はほぼ UML Port の概念を継承しており、ほぼ同等のものとみなす ことができる。RT コンポーネントのコンセプトにおいては、 Port はコンポーネントに付属し、コンポーネントが他のコンポーネントと相互作用 を行う接点であり、通常幾つかのインターフェースと関連付けられる。 コンポーネントは Port を通して外部に対しインターフェースを提供または要求 することができ、Portはその接続を管理する役割を担う。 Port の具象クラスは、通常 RT コンポーネントインスタンス生成時に同時に 生成され、提供・要求インターフェースを登録した後、RT コンポーネントに 登録され、外部からアクセス可能な Port として機能することを想定している。 RTC::Port は CORBA インターフェースとして以下のオペレーションを提供する。

このクラスでは、これらのオペレーションの実装を提供する。 これらのオペレーションのうち、get_port_profile(), get_connector_profiles(), get_connector_profile(), connect(), disconnect(), disconnect_all() は、 サブクラスにおいて特に振る舞いを変更する必要がないため、オーバーライド することは推奨されない。 notify_connect(), notify_disconnect() については、サブクラスが提供・要求 するインターフェースの種類に応じて、振る舞いを変更する必要が生ずる かもしれないが、これらを直接オーバーライドすることは推奨されず、 後述の notify_connect(), notify_disconnect() の項においても述べられる通り これらの関数に関連した protected 関数をオーバーライドすることにより 振る舞いを変更することが推奨される。


入れ子のクラスの概要
protected  class PortBase.connect_func
          ポート接続のためのヘルパクラスです。
protected  class PortBase.disconnect_all_func
          ポート接続解除のためのヘルパクラスです。
protected  class PortBase.disconnect_func
          ポート接続解除のためのヘルパクラスです。
protected  class PortBase.find_conn_id
          指定された接続IDを持つ接続プロファイルを検索するためのヘルパクラスです。
protected  class PortBase.find_interface
          指定されたインスタンス名と属性を持つインタフェースを検索するためのヘルパクラスです。
protected  class PortBase.find_port_ref
          指定されたPortオブジェクトと同じCORBAオブジェクト参照を持つPortオブジェクトを 検索するためのヘルパクラスです。
 
フィールドの概要
protected  int m_connectionLimit
           The maximum number of connections
protected static java.lang.String m_connectorsMutex
           
protected  PortService m_objref
          当該ポートのCORBAオブジェクト参照です。
protected  ConnectionCallback m_onConnected
           
protected  ConnectionCallback m_onConnectionLost
           
protected  ConnectionCallback m_onDisconnected
           
protected  ConnectionCallback m_onPublishInterfaces
          Callback functor objects
protected  ConnectionCallback m_onSubscribeInterfaces
           
protected  ConnectionCallback m_onUnsubscribeInterfaces
           
protected  java.lang.String m_ownerInstanceName
           
protected  PortConnectListeners m_portconnListeners
          PortConnectListenerホルダ PortConnectListenrを保持するホルダ
protected  PortProfile m_profile
          当該ポートに関連付けられているPortProfileオブジェクトです。
protected static java.lang.String m_profile_mutex
           
protected  Logbuf rtcout
           
 
コンストラクタの概要
PortBase()
          デフォルトコンストラクタ ポート名には空文字列が割り当てらる。
PortBase(java.lang.String name)
          コンストラクタ PortBase のコンストラクタは Port 名 name を引数に取り初期化を行う と同時に、自分自身を CORBA Object として活性化し、自身の PortProfile の port_ref に自身のオブジェクトリファレンスを格納する。
 
メソッドの概要
protected  ReturnCode_t _publishInterfaces()
           Publish interface information Publish interface information.
 PortService _this()
          当該PortのCORBAオブジェクト参照を取得する。
abstract  void activateInterfaces()
          Port の全てのインターフェースを activates する Port に登録されている全てのインターフェースを activate する。
protected
<T> void
addProperty(java.lang.String key, T value, java.lang.Class<T> klass)
          当該ポートが持つPortProfile内のpropertiesメンバに、 指定されたキーと値を持つNameValueオブジェクトを追加します。
protected  boolean appendInterface(java.lang.String instance_name, java.lang.String type_name, PortInterfacePolarity polarity)
          当該ポートが持つPortProfile内に含まれるPortInterfaceProfileメンバに、 引数で指定された情報を追加します。
protected  void appendProperty(java.lang.String key, java.lang.String value)
           Add NameValue data to PortProfile's properties Add NameValue data to PortProfile's properties.
protected  boolean checkPorts(PortService[] ports)
           
 ReturnCode_t connect(ConnectorProfileHolder connector_profile)
          [CORBA interface] Port の接続を行う {@.ja 与えられた ConnectoionProfile の情報に基づき、Port間の接続を確立 する。
protected  ReturnCode_t connectNext(ConnectorProfileHolder connector_profile)
          次の Port に対して notify_connect() をコールする ConnectorProfile の port_ref 内に格納されている Port のオブジェクト リファレンスのシーケンスの中から、自身の Port の次の Port に対して notify_connect() をコールする。
abstract  void deactivateInterfaces()
          全ての Port のインターフェースを deactivates する Port に登録されている全てのインターフェースを deactivate する。
protected  boolean deleteInterface(java.lang.String instance_name, PortInterfacePolarity polarity)
          指定されたインスタンス名と属性を持つインタフェースを、当該ポートが持つPortProfile内の PortInterfaceProfileから削除します。
 ReturnCode_t disconnect_all()
          [CORBA interface] Port の全接続を解除する このオペレーションはこの Port に関連した全ての接続を解除する。
 ReturnCode_t disconnect(java.lang.String connector_id)
          [CORBA interface] Port の接続を解除する {@.ja このオペレーションは与えられた connector_id に対応する接続を解除 する。
protected  ReturnCode_t disconnectNext(ConnectorProfile connector_profile)
          当該ポートの次のポートに対して接続解除通知を行います。
protected  boolean eraseConnectorProfile(java.lang.String connector_id)
          指定された接続IDに対応する接続プロファイルを、当該ポートのPortProfileから削除します。
protected  ConnectorProfile findConnProfile(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトが取得されます。
protected  int findConnProfileIndex(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトのシーケンス内でのインデクスが取得されます。
 ConnectorProfile get_connector_profile(java.lang.String connector_id)
          [CORBA interface] ConnectorProfile を取得する {@.ja connector_id で指定された ConnectorProfile を返す。
 ConnectorProfile[] get_connector_profiles()
          [CORBA interface] ConnectorProfileListを取得する {@.ja Portが保持する ConnectorProfile の sequence を返す。
 PortProfile get_port_profile()
          [CORBA interface] PortProfileを取得する {@.ja Portが保持するPortProfileを返す。
 java.lang.String getName()
          Port の名前を取得する Port の名前を取得する。
 PortProfile getPortProfile()
          PortProfile を取得する。
 PortService getPortRef()
          Port のオブジェクト参照を取得する このオペレーションは Port の PortProfile が保持している この Port 自身のオブジェクト参照を取得する。
 PortProfile getProfile()
          PortProfileを取得する Portが保持する PortProfile の const 参照を返す。
protected  java.lang.String getUUID()
          UUIDを生成します。
protected  boolean isEmptyId(ConnectorProfile connector_profile)
          指定されたConnectorProfileオブジェクト内のconnector_idメンバが空かどうか判定します。
protected  boolean isExistingConnId(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを判定します。
 ReturnCode_t notify_connect(ConnectorProfileHolder connector_profile)
          [CORBA interface] Port の接続通知を行う {@.ja このオペレーションは、Port間の接続が行われる際に、Port間で内部的 に呼ばれるオペレーションであって、通常アプリケーションプログラム や、Port以外のRTC関連オブジェクト等から呼び出されることは想定さ れていない。
 ReturnCode_t notify_disconnect(java.lang.String connector_id)
          [CORBA interface] Port の接続解除通知を行う {@.ja このオペレーションは、Port間の接続解除が行われる際に、Port間で内 部的に呼ばれるオペレーションであり、通常アプリケーションプログラ ムや、 Port 以外の RTC 関連オブジェクト等から呼び出されることは 想定されていない。
protected  void onConnected(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onConnectNextport(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onDisconnected(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onDisconnectNextport(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onNotifyConnect(java.lang.String portname, ConnectorProfile profile)
           
protected  void onNotifyDisconnect(java.lang.String portname, ConnectorProfile profile)
           
protected  void onPublishInterfaces(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onSubscribeInterfaces(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onUnsubscribeInterfaces(java.lang.String portname, ConnectorProfile profile)
           
protected abstract  ReturnCode_t publishInterfaces(ConnectorProfileHolder connector_profile)
          Interface情報を公開します。
protected  void setConnectionLimit(int limit_value)
           Set the maximum number of connections
 void setName(java.lang.String name)
          Port の名前を設定する {@.ja Port の名前を設定する。
 void setOnConnected(ConnectionCallback on_connected)
           Setting callback called on connection established This operation sets a functor that is called when connection between ports established.
 void setOnConnectionLost(ConnectionCallback on_connection_lost)
           
 void setOnDisconnected(ConnectionCallback on_disconnected)
           Setting callback called on disconnected This operation sets a functor that is called when connection between ports is destructed.
 void setOnPublishInterfaces(ConnectionCallback on_publish)
           Setting callback called on publish interfaces This operation sets a functor that is called after publishing interfaces process when connecting between ports.
 void setOnSubscribeInterfaces(ConnectionCallback on_subscribe)
           Setting callback called on publish interfaces This operation sets a functor that is called before subscribing interfaces process when connecting between ports.
 void setOnUnsubscribeInterfaces(ConnectionCallback on_unsubscribe)
           Setting callback called on unsubscribe interfaces This operation sets a functor that is called before unsubscribing interfaces process when disconnecting between ports.
 void setOwner(RTObject owner)
          Port の owner の RTObject を指定する このオペレーションは Port の PortProfile.owner を設定する。
 void setPortConnectListenerHolder(PortConnectListeners portconnListeners)
          PortConnectListeners のホルダをセットする {@.ja ポートの接続に関するリスナ群を保持するホルダクラスへのポインタを セットする。
 void setPortRef(PortService port_ref)
          Port のオブジェクト参照を設定する このオペレーションは Port の PortProfile にこの Port 自身の オブジェクト参照を設定する。
protected  void setUUID(ConnectorProfileHolder connector_profile)
          UUIDを生成し、指定されたConnectorProfileオブジェクトのconnector_idメンバに設定します。
protected abstract  ReturnCode_t subscribeInterfaces(ConnectorProfileHolder connector_profile)
          Interface 情報を公開します。
protected abstract  void unsubscribeInterfaces(ConnectorProfile connector_profile)
          Interfaceの接続を解除します。
protected  void updateConnectorProfile(ConnectorProfile connector_profile)
          指定された接続プロファイルを、当該ポートのPortProfileに追加します。
protected  void updateConnectors()
           
 
クラス RTC.PortServicePOA から継承されたメソッド
_all_interfaces, _invoke, _this
 
クラス 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
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

m_profile

protected PortProfile m_profile

当該ポートに関連付けられているPortProfileオブジェクトです。


m_profile_mutex

protected static java.lang.String m_profile_mutex

m_connectorsMutex

protected static java.lang.String m_connectorsMutex

m_objref

protected PortService m_objref

当該ポートのCORBAオブジェクト参照です。


rtcout

protected Logbuf rtcout

m_onPublishInterfaces

protected ConnectionCallback m_onPublishInterfaces

Callback functor objects


m_onSubscribeInterfaces

protected ConnectionCallback m_onSubscribeInterfaces

m_onConnected

protected ConnectionCallback m_onConnected

m_onUnsubscribeInterfaces

protected ConnectionCallback m_onUnsubscribeInterfaces

m_onDisconnected

protected ConnectionCallback m_onDisconnected

m_onConnectionLost

protected ConnectionCallback m_onConnectionLost

m_portconnListeners

protected PortConnectListeners m_portconnListeners
PortConnectListenerホルダ

PortConnectListenrを保持するホルダ


m_connectionLimit

protected int m_connectionLimit

The maximum number of connections


m_ownerInstanceName

protected java.lang.String m_ownerInstanceName
コンストラクタの詳細

PortBase

public PortBase(java.lang.String name)
コンストラクタ

PortBase のコンストラクタは Port 名 name を引数に取り初期化を行う と同時に、自分自身を CORBA Object として活性化し、自身の PortProfile の port_ref に自身のオブジェクトリファレンスを格納する。

パラメータ:
name - Port の名前(デフォルト値:"")

PortBase

public PortBase()
デフォルトコンストラクタ

ポート名には空文字列が割り当てらる。

メソッドの詳細

_this

public PortService _this()
当該PortのCORBAオブジェクト参照を取得する。

オーバーライド:
クラス PortServicePOA 内の _this
戻り値:
当該PortのCORBAオブジェクト参照

get_port_profile

public PortProfile get_port_profile()
[CORBA interface] PortProfileを取得する

Portが保持するPortProfileを返す。この関数は CORBA オペレーション であり、CORBA のメモリ管理規則に従い、呼び出し側は返される PortProfile オブジェクトを解体する責任がある。PortProfile 構造体 は以下のメンバーを持つ。

事後条件:この関数を呼び出すことにより内部状態が変更されることはない。

戻り値:
PortProfile

getPortProfile

public final PortProfile getPortProfile()
PortProfile を取得する。

この関数は、オブジェクト内部に保持されている PortProfile の const 参照を返す const 関数である。 事後条件:この関数を呼び出すことにより内部状態が変更されることはない。

戻り値:
PortProfile

get_connector_profiles

public ConnectorProfile[] get_connector_profiles()
[CORBA interface] ConnectorProfileListを取得する

Portが保持する ConnectorProfile の sequence を返す。この関数は CORBA オペレーションであり、CORBA のメモリ管理規則に従い、呼び出 し側は返される ConnectorProfileList オブジェクトを解体する責任が ある。 ConnectorProfile は Port 間の接続プロファイル情報を保持する構造体であり、 接続時にPort間で情報交換を行い、関連するすべての Port で同一の値が 保持される。 ConnectorProfile は以下のメンバーを保持している。

事後条件:この関数を呼び出すことにより内部状態が変更されることはない。

戻り値:
この Port が保持する ConnectorProfile

get_connector_profile

public ConnectorProfile get_connector_profile(java.lang.String connector_id)
[CORBA interface] ConnectorProfile を取得する

connector_id で指定された ConnectorProfile を返す。この関数は CORBA オペレーションであり、CORBA のメモリ管理規則に従い、呼び出 し側は返される ConnectorProfile オブジェクトを解体する責任がある。 事前条件:引数に与える connector_id は有効な文字列でなければならない。 空文字を指定した場合、または指定した connector_id を持つ ConnectorProfile が見つからない場合は、空の ConnectorProfile を 返す。 事後条件:この関数を呼び出すことにより内部状態が変更されることはない。

パラメータ:
connector_id - ConnectorProfile の ID
戻り値:
connector_id で指定された ConnectorProfile

connect

public ReturnCode_t connect(ConnectorProfileHolder connector_profile)
[CORBA interface] Port の接続を行う

与えられた ConnectoionProfile の情報に基づき、Port間の接続を確立 する。この関数は主にアプリケーションプログラムやツールから呼び出 すことを前提としている。 事前条件:

事後条件:

パラメータ:
connector_profile - ConnectorProfile
戻り値:
ReturnCode_t 型のリターンコード

notify_connect

public ReturnCode_t notify_connect(ConnectorProfileHolder connector_profile)
[CORBA interface] Port の接続通知を行う

このオペレーションは、Port間の接続が行われる際に、Port間で内部的 に呼ばれるオペレーションであって、通常アプリケーションプログラム や、Port以外のRTC関連オブジェクト等から呼び出されることは想定さ れていない。 notify_connect() 自体はテンプレートメソッドパターンとして、サブ クラスで実装されることが前提の publishInterfaces(), subscribeInterfaces() の2つの関数を内部で呼び出す。処理の手順は 以下の通りである。 - publishInterfaces(): インターフェース情報の公開 - connectNext(): 次の Port の notify_connect() の呼び出し - subscribeInterfaces(): インターフェース情報の取得 - 接続情報の保存 notify_connect() は ConnectorProfile::ports に格納されている Port の順序に従って、カスケード状に呼び出しを行うことにより、イ ンターフェース情報の公開と取得を関連すすべてのポートに対して行う。 このカスケード呼び出しは途中で中断されることはなく、必ず ConnectorProfile::ports に格納されている全ポートに対して行われる。

事前条件:
notify_connect() は ConnectorProfile::ports 内に格納されて いる Port 参照リストのうち、当該 Port 自身の参照の次に格納されて いる Port に対して notify_connect() を呼び出す。したがって ConnectorProfile::ports には当該 Port の参照が格納されている必要 がある。もし、自身の参照が格納されていない場合、その他の処理によ りエラーが上書きされなければ、BAD_PARAMETER エラーが返される。 呼び出し時に ConnectorProfile::connector_id には一意なIDと して UUID が保持されている必要がある。通常 connector_id は connect() 関数により与えられ、空文字の場合は動作は未定義である。

事後条件:
ConnectorProfile::name, ConnectorProfile::connector_id, ConnectorProfile::ports は notify_connect() の呼び出しにより 書き換えられることはなく不変である。 ConnectorProfile::properties は notify_connect() の内部で、 当該 Port が持つサービスインターフェースに関する情報を他の Port に伝えるために、プロパティ情報が書き込まれる。 なお、ConnectorProfile::ports のリストの最初 Port の notify_connet() が終了した時点では、すべての関連する Port の notify_connect() の呼び出しが完了する。publishInterfaces(), connectNext(), subscribeInterfaces() および接続情報の保存のいず れかの段階でエラーが発生した場合でも、エラーコードは内部的に保持 されており、最初に生じたエラーのエラーコードが返される。

パラメータ:
connector_profile - ConnectorProfileHolder
戻り値:
ReturnCode_t 型のリターンコード

disconnect

public ReturnCode_t disconnect(java.lang.String connector_id)
[CORBA interface] Port の接続を解除する

このオペレーションは与えられた connector_id に対応する接続を解除 する。connector_id は通常、システム全体において一意な UUID の文 字列であり、事前に connect()/notify_connect() の呼び出しにより確 立された接続プロファイル ConnectorProfile::connector_id に対応す る。 事前条件:

パラメータ:
connector_id - ConnectorProfile の ID
戻り値:
ReturnCode_t 型のリターンコード

notify_disconnect

public ReturnCode_t notify_disconnect(java.lang.String connector_id)
[CORBA interface] Port の接続解除通知を行う

このオペレーションは、Port間の接続解除が行われる際に、Port間で内 部的に呼ばれるオペレーションであり、通常アプリケーションプログラ ムや、 Port 以外の RTC 関連オブジェクト等から呼び出されることは 想定されていない。 notify_disconnect() 自体はテンプレートメソッドパターンとして、サ ブクラスで実装されることが前提の unsubscribeInterfaces() 関数を 内部で呼び出す。処理の手順は以下の通りである。 - ConnectorProfile の検索 - 次の Port の notify_disconnect() 呼び出し - unsubscribeInterfaces() - ConnectorProfile の削除 notify_disconnect() は ConnectorProfile::ports に格納されている Port の順序に従って、カスケード状に呼び出しを行うことにより、接 続の解除をすべての Port に通知する。

事前条件:
Port は与えられた connector_id に対応する ConnectorProfile を保持していなければならない。

事後条件:
connector_id に対応する ConnectorProfile が見つからない場 合はBAD_PARAMETER エラーを返す。 カスケード呼び出しを行う際には ConnectorProfile::ports に 保持されている Port の参照リストのうち、自身の参照の次の参照に対 して notify_disconnect() を呼び出すが、その呼び出しで例外が発生 した場合には、呼び出しをスキップしリストの次の参照に対して notify_disconnect() を呼び出す。一つも呼び出しに成功しない場合、 RTC_ERROR エラーコードを返す。 なお、ConnectorProfile::ports のリストの最初 Port の notify_disconnet() が終了した時点では、すべての関連する Port の notify_disconnect() の呼び出しが完了する。

パラメータ:
connector_id - ConnectorProfile の ID
戻り値:
ReturnCode_t 型のリターンコード

disconnect_all

public ReturnCode_t disconnect_all()
[CORBA interface] Port の全接続を解除する

このオペレーションはこの Port に関連した全ての接続を解除する。

戻り値:
ReturnCode_t 型のリターンコード

activateInterfaces

public abstract void activateInterfaces()
Port の全てのインターフェースを activates する

Port に登録されている全てのインターフェースを activate する。


deactivateInterfaces

public abstract void deactivateInterfaces()
全ての Port のインターフェースを deactivates する

Port に登録されている全てのインターフェースを deactivate する。


setName

public void setName(java.lang.String name)
Port の名前を設定する

Port の名前を設定する。この名前は Port が保持する PortProfile.name に反映される。

パラメータ:
name - Port の名前

getName

public final java.lang.String getName()
Port の名前を取得する

Port の名前を取得する。

戻り値:
Port の名前

getProfile

public final PortProfile getProfile()
PortProfileを取得する

Portが保持する PortProfile の const 参照を返す。

戻り値:
この Port の PortProfile

setPortRef

public void setPortRef(PortService port_ref)
Port のオブジェクト参照を設定する

このオペレーションは Port の PortProfile にこの Port 自身の オブジェクト参照を設定する。

パラメータ:
port_ref - この Port のオブジェクト参照

getPortRef

public PortService getPortRef()
Port のオブジェクト参照を取得する

このオペレーションは Port の PortProfile が保持している この Port 自身のオブジェクト参照を取得する。

戻り値:
この Port のオブジェクト参照 {`.en The object reference of this Port.}

setOwner

public void setOwner(RTObject owner)
Port の owner の RTObject を指定する

このオペレーションは Port の PortProfile.owner を設定する。

パラメータ:
owner - この Port を所有する RTObject の参照

setOnPublishInterfaces

public void setOnPublishInterfaces(ConnectionCallback on_publish)

Setting callback called on publish interfaces

This operation sets a functor that is called after publishing interfaces process when connecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called after calling publishInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of publishInterfaces() function. Although by using this functor, you can modify the ConnectorProfile published by publishInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

パラメータ:
on_publish - ConnectionCallback's subclasses

setOnSubscribeInterfaces

public void setOnSubscribeInterfaces(ConnectionCallback on_subscribe)

Setting callback called on publish interfaces

This operation sets a functor that is called before subscribing interfaces process when connecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called before calling subscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of subscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for subscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

パラメータ:
on_subscribe - ConnectionCallback's subclasses

setOnConnected

public void setOnConnected(ConnectionCallback on_connected)

Setting callback called on connection established

This operation sets a functor that is called when connection between ports established.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called only when notify_connect() function successfully returns. In case of error, the functor will not be called.

Since this functor is called with ConnectorProfile argument that is same as out-parameter of notify_connect() function, you can get all the information of published interfaces of related ports in the connection. Although by using this functor, you can modify ConnectorProfile argument for out-paramter of notify_connect(), the modification should be done carefully for fear of causing connection inconsistency.

パラメータ:
on_connected - ConnectionCallback's subclasses

setOnUnsubscribeInterfaces

public void setOnUnsubscribeInterfaces(ConnectionCallback on_unsubscribe)

Setting callback called on unsubscribe interfaces

This operation sets a functor that is called before unsubscribing interfaces process when disconnecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called before calling unsubscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of unsubscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for unsubscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

パラメータ:
on_unsubscribe - ConnectionCallback's subclasses

setOnDisconnected

public void setOnDisconnected(ConnectionCallback on_disconnected)

Setting callback called on disconnected

This operation sets a functor that is called when connection between ports is destructed.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called just before notify_disconnect() that is disconnection execution function returns.

This functor is called with argument of corresponding ConnectorProfile. Since this ConnectorProfile will be destructed after calling this functor, modifications never affect others.

パラメータ:
on_disconnected - ConnectionCallback's subclasses

setOnConnectionLost

public void setOnConnectionLost(ConnectionCallback on_connection_lost)

setPortConnectListenerHolder

public void setPortConnectListenerHolder(PortConnectListeners portconnListeners)
PortConnectListeners のホルダをセットする

ポートの接続に関するリスナ群を保持するホルダクラスへのポインタを セットする。この関数は通常親のRTObjectから呼ばれ、RTObjectが持つ ホルダクラスへのポインタがセットされる。

パラメータ:
portconnListeners - PortConnectListeners オブジェクトのポインタ

publishInterfaces

protected abstract ReturnCode_t publishInterfaces(ConnectorProfileHolder connector_profile)

Interface情報を公開します。 このメソッドは、notify_connect()処理シーケンスの始めに呼び出されるテンプレートメソッドです。

notify_connect()内では、以下の順にテンプレートメソッドが呼び出されて接続処理が行われます。

  1. publishInterfaces()
  2. connectNext()
  3. subscribeInterfaces()
  4. updateConnectorProfile()

具象Portクラスでは、このメソッドをオーバーライドし、引数として与えられた ConnectorProfileに従って処理を行い、パラメータが不適切であれば、ReturnCode_t型の エラーコードを返します。

通常、publishInterafaces()内においては、このポートに属するインターフェースに関する情報を ConnectorProfileに対して適切に設定し、他のポートに通知しなければなりません。 また、このメソッドが呼び出される段階では、他のポートのInterfaceに関する情報は すべては含まれていないので、他のポートのInterfaceを取得する処理はsubscribeInterfaces()内で 行われるべきです。

このメソッドは、新規のコネクタIDに対しては接続の生成が、既存のコネクタIDに対しては更新が 適切に行われる必要があります。

パラメータ:
connector_profile - 接続プロファイル
戻り値:
ReturnCode_t型の戻り値

connectNext

protected ReturnCode_t connectNext(ConnectorProfileHolder connector_profile)
次の Port に対して notify_connect() をコールする

ConnectorProfile の port_ref 内に格納されている Port のオブジェクト リファレンスのシーケンスの中から、自身の Port の次の Port に対して notify_connect() をコールする。

パラメータ:
connector_profile - 接続に関するプロファイル情報
戻り値:
ReturnCode_t 型のリターンコード

disconnectNext

protected ReturnCode_t disconnectNext(ConnectorProfile connector_profile)

当該ポートの次のポートに対して接続解除通知を行います。

ConnectorProfile内に設定されているPortのシーケンスを調べて、 当該Portの次のPortを特定し、そのPortに対してnotify_disconnect()を呼び出します。

パラメータ:
connector_profile - 接続プロファイル

subscribeInterfaces

protected abstract ReturnCode_t subscribeInterfaces(ConnectorProfileHolder connector_profile)

Interface 情報を公開します。

このメソッドは、notify_connect()処理シーケンスの中間に呼び出されるテンプレートメソッドです。 notify_connect()では、

  1. publishInterfaces()
  2. connectNext()
  3. subscribeInterfaces()
  4. updateConnectorProfile()
の順にprotectedメソッドが呼び出されて接続処理が行われます。

このメソッドの処理は、新規のconnector_idに対しては接続の生成が適切に行われる必要があります。
また、既存のconnector_idに対しては更新が適切に行われる必要があります。

パラメータ:
connector_profile - 接続プロファイル情報
戻り値:
ReturnCode_t 戻り値

unsubscribeInterfaces

protected abstract void unsubscribeInterfaces(ConnectorProfile connector_profile)

Interfaceの接続を解除します。

このメソッドは、notify_disconnect()処理シーケンスの終わりに呼び出されるテンプレートメソッドです。 notify_disconnect()では、

  1. disconnectNext()
  2. unsubscribeInterfaces()
  3. eraseConnectorProfile()
の順にprotectedメソッドが呼び出されて接続解除処理が行われます。

具象クラスでは、このメソッドをオーバーライドし、引数として 与えられた ConnectorProfile に従い接続解除処理を行います。

パラメータ:
connector_profile - 接続プロファイル情報

isEmptyId

protected boolean isEmptyId(ConnectorProfile connector_profile)

指定されたConnectorProfileオブジェクト内のconnector_idメンバが空かどうか判定します。

戻り値:
空であればtrueを、さもなくばfalseを返します。

getUUID

protected java.lang.String getUUID()

UUIDを生成します。

戻り値:
生成されたUUID

setUUID

protected void setUUID(ConnectorProfileHolder connector_profile)

UUIDを生成し、指定されたConnectorProfileオブジェクトのconnector_idメンバに設定します。

パラメータ:
connector_profile - 設定先となるConnectorProfileオブジェクト

isExistingConnId

protected boolean isExistingConnId(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを判定します。

戻り値:
存在すればtrueを、さもなくばfalseを返します。

findConnProfile

protected ConnectorProfile findConnProfile(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトが取得されます。

パラメータ:
id - 接続ID
戻り値:
指定した接続IDを持つConnectorProfileオブジェクトが見つかった場合は、 そのオブジェクトを返します。
見つからない場合は、空のConnectorProfileオブジェクトを返します。

findConnProfileIndex

protected int findConnProfileIndex(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトのシーケンス内でのインデクスが取得されます。

戻り値:
指定した接続IDを持つConnectorProfileオブジェクトが見つかった場合は、 そのオブジェクトのシーケンス内インデクスを返します。
見つからない場合は、-1を返します。

updateConnectorProfile

protected void updateConnectorProfile(ConnectorProfile connector_profile)

指定された接続プロファイルを、当該ポートのPortProfileに追加します。 同一の接続IDを持つ接続プロファイルがすでにある場合は、その内容を上書きします。

パラメータ:
connector_profile - 追加もしくは更新する接続プロファイル

eraseConnectorProfile

protected boolean eraseConnectorProfile(java.lang.String connector_id)

指定された接続IDに対応する接続プロファイルを、当該ポートのPortProfileから削除します。

パラメータ:
connector_id - 削除対象となる接続プロファイルの接続ID
戻り値:
削除された場合はtrueを返します。
また、指定された接続IDの接続プロファイルが見つからない場合はfalseを返します。

appendInterface

protected boolean appendInterface(java.lang.String instance_name,
                                  java.lang.String type_name,
                                  PortInterfacePolarity polarity)

当該ポートが持つPortProfile内に含まれるPortInterfaceProfileメンバに、 引数で指定された情報を追加します。この情報は、get_port_profile()メソッドによって 得られるPortProfileにうち、PortInterfaceProfileの値を変更するのみであり、 実際にインタフェースを提供したり要求したりする場合には、サブクラス側で publishInterface(), subscribeInterface()などのメソッドを適切にオーバライドし、 インタフェースの提供や要求処理を行う必要があります。

なお、インタフェース(のインスタンス)名は、ポート内で一意でなければなりません。

パラメータ:
instance_name - インタフェースのインスタンス名
type_name - インタフェースの型名称
polarity - インタフェースの属性(提供インタフェースまたは要求インタフェース)
戻り値:
正常に登録できた場合はtrueを返します。 また、同名のインタフェースがすでに登録済みの場合はfalseを返します。

deleteInterface

protected boolean deleteInterface(java.lang.String instance_name,
                                  PortInterfacePolarity polarity)

指定されたインスタンス名と属性を持つインタフェースを、当該ポートが持つPortProfile内の PortInterfaceProfileから削除します。

パラメータ:
instance_name - 削除対象インタフェースのインスタンス名
polarity - 削除対象インタフェースの属性
戻り値:
正常に削除できた場合はtrueを返します。 また、該当するインタフェースが見つからない場合はfalseを返します。

addProperty

protected <T> void addProperty(java.lang.String key,
                               T value,
                               java.lang.Class<T> klass)

当該ポートが持つPortProfile内のpropertiesメンバに、 指定されたキーと値を持つNameValueオブジェクトを追加します。

パラメータ:
key - キー
value - 値

appendProperty

protected void appendProperty(java.lang.String key,
                              java.lang.String value)

Add NameValue data to PortProfile's properties

Add NameValue data to PortProfile's properties. Type of additional data is specified by ValueType.

パラメータ:
key - The name of properties
value - The value of properties

updateConnectors

protected void updateConnectors()

checkPorts

protected boolean checkPorts(PortService[] ports)

onNotifyConnect

protected void onNotifyConnect(java.lang.String portname,
                               ConnectorProfile profile)

onNotifyDisconnect

protected void onNotifyDisconnect(java.lang.String portname,
                                  ConnectorProfile profile)

onUnsubscribeInterfaces

protected void onUnsubscribeInterfaces(java.lang.String portname,
                                       ConnectorProfile profile)

onPublishInterfaces

protected void onPublishInterfaces(java.lang.String portname,
                                   ConnectorProfile profile,
                                   ReturnCode_t ret)

onConnectNextport

protected void onConnectNextport(java.lang.String portname,
                                 ConnectorProfile profile,
                                 ReturnCode_t ret)

onSubscribeInterfaces

protected void onSubscribeInterfaces(java.lang.String portname,
                                     ConnectorProfile profile,
                                     ReturnCode_t ret)

onConnected

protected void onConnected(java.lang.String portname,
                           ConnectorProfile profile,
                           ReturnCode_t ret)

onDisconnectNextport

protected void onDisconnectNextport(java.lang.String portname,
                                    ConnectorProfile profile,
                                    ReturnCode_t ret)

onDisconnected

protected void onDisconnected(java.lang.String portname,
                              ConnectorProfile profile,
                              ReturnCode_t ret)

_publishInterfaces

protected ReturnCode_t _publishInterfaces()

Publish interface information

Publish interface information.

戻り値:
The return code of ReturnCode_t type

setConnectionLimit

protected void setConnectionLimit(int limit_value)

Set the maximum number of connections

パラメータ:
limit_value - The maximum number of connections