クラス RTC::PortBase

Port の基底クラス. [詳細]

#include <PortBase.h>

RTC::PortBaseに対する継承グラフ
RTC::CorbaPort RTC::InPortBase RTC::OutPortBase RTC::InPort< DataType > RTC::OutPort< DataType >

すべてのメンバ一覧

構成

struct  find_conn_id
 id を持つ ConnectorProfile を探す Functor [詳細]
struct  find_interface
 name と polarity から interface を探す Functor [詳細]
struct  find_port_ref
 コンストラクタ引数 port_ref と同じオブジェクト参照を探す Functor [詳細]

Public メソッド

 PortBase (const char *name="")
 コンストラクタ
virtual ~PortBase (void)
 デストラクタ
virtual PortProfile * get_port_profile () throw (CORBA::SystemException)
 [CORBA interface] PortProfileを取得する
const PortProfile & getPortProfile () const
 PortProfile を取得する。.
virtual ConnectorProfileList * get_connector_profiles () throw (CORBA::SystemException)
 [CORBA interface] ConnectorProfileListを取得する
virtual ConnectorProfile * get_connector_profile (const char *connector_id) throw (CORBA::SystemException)
 [CORBA interface] ConnectorProfile を取得する
virtual ReturnCode_t connect (ConnectorProfile &connector_profile) throw (CORBA::SystemException)
 [CORBA interface] Port の接続を行う
virtual ReturnCode_t notify_connect (ConnectorProfile &connector_profile) throw (CORBA::SystemException)
 [CORBA interface] Port の接続通知を行う
virtual ReturnCode_t disconnect (const char *connector_id) throw (CORBA::SystemException)
 [CORBA interface] Port の接続を解除する
virtual ReturnCode_t notify_disconnect (const char *connector_id) throw (CORBA::SystemException)
 [CORBA interface] Port の接続解除通知を行う
virtual ReturnCode_t disconnect_all () throw (CORBA::SystemException)
 [CORBA interface] Port の全接続を解除する
virtual void activateInterfaces ()=0
 Port の全てのインターフェースを activates する.
virtual void deactivateInterfaces ()=0
 全ての Port のインターフェースを deactivates する
void setName (const char *name)
 Port の名前を設定する.
const char * getName () const
 Port の名前を取得する.
const PortProfile & getProfile () const
 PortProfileを取得する.
void setPortRef (PortService_ptr port_ref)
 Port のオブジェクト参照を設定する.
PortService_ptr getPortRef ()
 Port のオブジェクト参照を取得する.
void setOwner (RTObject_ptr owner)
 Port の owner の RTObject を指定する.
void setOnPublishInterfaces (ConnectionCallback *on_publish)
 インターフェースを公開する際に呼ばれるコールバックをセットする
void setOnSubscribeInterfaces (ConnectionCallback *on_subscribe)
 インターフェースを取得する際に呼ばれるコールバックをセットする
void setOnConnected (ConnectionCallback *on_connected)
 接続完了時に呼ばれるコールバックをセットする
void setOnUnsubscribeInterfaces (ConnectionCallback *on_subscribe)
 インターフェースを解放する際に呼ばれるコールバックをセットする
void setOnDisconnected (ConnectionCallback *on_disconnected)
 接続解除に呼ばれるコールバックをセットする
void setOnConnectionLost (ConnectionCallback *on_connection_lost)
 ポートの接続がロストした場合に呼び出されるコールバックをセットする
void setPortConnectListenerHolder (PortConnectListeners *portconnListeners)
 PortConnectListeners のホルダをセットする.

Protected 型

typedef coil::Guard< coil::MutexGuard

Protected メソッド

virtual ReturnCode_t publishInterfaces (ConnectorProfile &connector_profile)=0
 Interface 情報を公開する.
virtual ReturnCode_t connectNext (ConnectorProfile &connector_profile)
 次の Port に対して notify_connect() をコールする
virtual ReturnCode_t disconnectNext (ConnectorProfile &connector_profile)
 次の Port に対して notify_disconnect() をコールする
virtual ReturnCode_t subscribeInterfaces (const ConnectorProfile &connector_profile)=0
 Interface 情報を公開する.
virtual void unsubscribeInterfaces (const ConnectorProfile &connector_profile)=0
 Interface の接続を解除する.
virtual void setConnectionLimit (int limit_value)
 接続の最大数を設定する。
virtual ReturnCode_t _publishInterfaces (void)
 Interface情報を公開する.
bool isEmptyId (const ConnectorProfile &connector_profile) const
 ConnectorProfile の connector_id フィールドが空かどうか判定.
const std::string getUUID () const
 UUIDを生成する.
void setUUID (ConnectorProfile &connector_profile) const
 UUIDを生成し ConnectorProfile にセットする.
bool isExistingConnId (const char *id)
 id が既存の ConnectorProfile のものかどうか判定する
ConnectorProfile findConnProfile (const char *id)
 id を持つ ConnectorProfile を探す
CORBA::Long findConnProfileIndex (const char *id)
 id を持つ ConnectorProfile を探す
void updateConnectorProfile (const ConnectorProfile &connector_profile)
 ConnectorProfile の追加もしくは更新.
bool eraseConnectorProfile (const char *id)
 ConnectorProfile を削除する.
bool appendInterface (const char *name, const char *type_name, PortInterfacePolarity pol)
 PortInterfaceProfile に インターフェースを登録する.
bool deleteInterface (const char *name, PortInterfacePolarity pol)
 PortInterfaceProfile からインターフェース登録を削除する.
template<class ValueType >
void addProperty (const char *key, ValueType value)
 PortProfile の properties に NameValue 値を追加する.
void appendProperty (const char *key, const char *value)
 PortProfile の properties に NameValue 値を要素に追加する.
void updateConnectors ()
 存在しないポートをdisconnectする。
bool checkPorts (::RTC::PortServiceList &ports)
 ポートの存在を確認する。
void onNotifyConnect (const char *portname, RTC::ConnectorProfile &profile)
void onNotifyDisconnect (const char *portname, RTC::ConnectorProfile &profile)
void onUnsubscribeInterfaces (const char *portname, RTC::ConnectorProfile &profile)
void onPublishInterfaces (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
void onConnectNextport (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
void onSubscribeInterfaces (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
void onConnected (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
void onDisconnectNextport (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
void onDisconnected (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)

Protected 変数

Logger rtclog
 ロガーストリーム
PortProfile m_profile
 Port の PortProfile.
RTC::PortService_var m_objref
 Port の オブジェクト参照.
coil::Mutex m_profile_mutex
 PortProfile の mutex.
coil::Mutex m_connectorsMutex
std::string m_ownerInstanceName
 インスタンス名
int m_connectionLimit
 Port の接続の最大数.
ConnectionCallbackm_onPublishInterfaces
 Callback functor オブジェクト.
ConnectionCallbackm_onSubscribeInterfaces
 Callback functor オブジェクト.
ConnectionCallbackm_onConnected
 Callback functor オブジェクト.
ConnectionCallbackm_onUnsubscribeInterfaces
 Callback functor オブジェクト.
ConnectionCallbackm_onDisconnected
 Callback functor オブジェクト.
ConnectionCallbackm_onConnectionLost
 Callback functor オブジェクト.
PortConnectListenersm_portconnListeners
 PortConnectListenerホルダ.

説明

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 関数をオーバーライドすることにより 振る舞いを変更することが推奨される。

から:
0.4.0

型定義


コンストラクタとデストラクタ

RTC::PortBase::PortBase ( const char *  name = ""  ) 

コンストラクタ

PortBase のコンストラクタは Port 名 name を引数に取り初期化を行う と同時に、自分自身を CORBA Object として活性化し、自身の PortProfile の port_ref に自身のオブジェクトリファレンスを格納する。 名前には、"." 以外の文字列を使用することができる。

引数:
name Port の名前(デフォルト値:"")
virtual RTC::PortBase::~PortBase ( void   )  [virtual]

デストラクタ

デストラクタでは、PortService CORBA オブジェクトの deactivate を 行う。deactivateに際して例外を投げることはない。


関数

virtual ReturnCode_t RTC::PortBase::_publishInterfaces ( void   )  [protected, virtual]

Interface情報を公開する.

Interface情報を公開する。

dataport.dataflow_type

戻り値:
ReturnCode_t 型のリターンコード
virtual void RTC::PortBase::activateInterfaces (  )  [pure virtual]

Port の全てのインターフェースを activates する.

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

RTC::CorbaPort, RTC::InPortBase, と RTC::OutPortBaseで実装されています。

template<class ValueType >
void RTC::PortBase::addProperty ( const char *  key,
ValueType  value 
) [inline, protected]

PortProfile の properties に NameValue 値を追加する.

PortProfile の properties に NameValue 値を追加する。 追加するデータの型をValueTypeで指定する。

引数:
key properties の name
value properties の value

参照先 m_profile, NVUtil::newNV(), と CORBA_SeqUtil::push_back().

bool RTC::PortBase::appendInterface ( const char *  name,
const char *  type_name,
PortInterfacePolarity  pol 
) [protected]

PortInterfaceProfile に インターフェースを登録する.

このオペレーションは Port が持つ PortProfile の、PortInterfaceProfile にインターフェースの情報を追加する。 この情報は、get_port_profile() によって得られる PortProfile のうち PortInterfaceProfile の値を変更するのみであり、実際にインターフェースを 提供したり要求したりする場合には、サブクラスで、 publishInterface() , subscribeInterface() 等の関数を適切にオーバーライドしインターフェースの 提供、要求処理を行わなければならない。

インターフェース(のインスタンス)名は Port 内で一意でなければならない。 同名のインターフェースがすでに登録されている場合、この関数は false を 返す。

引数:
name インターフェースのインスタンスの名前
type_name インターフェースの型の名前
pol インターフェースの属性 (RTC::PROVIDED もしくは RTC:REQUIRED)
戻り値:
インターフェース登録処理結果。 同名のインターフェースが既に登録されていれば false を返す。
void RTC::PortBase::appendProperty ( const char *  key,
const char *  value 
) [inline, protected]

PortProfile の properties に NameValue 値を要素に追加する.

PortProfile の properties に NameValue 値を要素に追加する。この 関数により設定された properties は get_prot_profile() により外部 から参照される。

引数:
key properties の name
value properties の value

参照先 NVUtil::appendStringValue(), と m_profile.

bool RTC::PortBase::checkPorts ( ::RTC::PortServiceList &  ports  )  [protected]

ポートの存在を確認する。

引数:
ports 確認するポート
戻り値:
true:存在する,false:存在しない
virtual ReturnCode_t RTC::PortBase::connect ( ConnectorProfile &  connector_profile  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] Port の接続を行う

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

事前条件:
アプリケーションプログラムは、コンポーネント間の複数の Port を接続するために、適切な値をセットした ConnectorProfile を connect() の引数として与えて呼び出さなければならない。
connect() に与える ConnectorProfile のメンバーのうち、 name, ports, properties メンバーに対してデータをセットしなければ ならない。connector_id には通常空文字を設定するか、適当なUUIDを 文字列で設定する必要がある。
ConnectorProfile::name は接続につける名前で CORBA::string 型に格納できる任意の文字列である必要がある。
ConnectorProfile::connector_id はすべての接続に対して一意な ID (通常はUUID) が格納される。UUIDの設定は connect() 関数内で行 われるので、呼び出し側は空文字を設定する。既存の接続と同じUUIDを 設定し connect() を呼び出した場合には PRECONDITION_NOT_MET エラー を返す。ただし、将来の拡張で既存の接続プロファイルを更新するため に既存の UUID を設定して呼び出す使用法が用いられる可能性がある。
ConnectorProfile::ports は RTC::PortService のシーケンスで、 接続を構成する通常2つ以上のポートのオブジェクト参照を代入する必 要がある。例外として、ポートのオブジェクト参照を1つだけ格納して connect()を呼び出すことで、ポートのインターフェース情報を取得し たり、特殊なポート(CORBAのRTCPortService以外の相手)に対して接 続を行う場合もある。
ConnectorProfile::properties はポートに関連付けられたインター フェースに対するプロパティを与えるために使用する。プロパティは、 string 型をキー、Any 型を値としてもつペアのシーケンスであり、値 には任意のCORBAデータ型を格納できるが、可能な限り string 型とし て格納されることが推奨される。
以上 connect() 呼び出し時に設定する ConnectorProfile のメン バをまとめると以下のようになる。
  • ConnectorProfile::name: 任意の接続名
  • ConnectorProfile::connector_id: 空文字
  • ConnectorProfile::ports: 1つ以上のポート
  • ConnectorProfile::properties: インターフェースに対するプロパティ
事後条件:
connect() 関数は、ConnectorProfileportsに格納されたポー トシーケンスの先頭のポートに対して notify_connect() を呼ぶ。
notify_connect() は ConnectorProfile::ports に格納されたポー ト順に notify_connect() をカスケード呼び出しする。このカスケード 呼び出しは、途中のnotify_connect() でエラーが出てもポートのオブ ジェクト参照が有効である限り、必ずすべてのポートに対して行われる ことが保証される。有効でないオブジェクト参照がシーケンス中に存在 する場合、そのポートをスキップして、次のポートに対して notify_connect() を呼び出す。
connect() 関数は、notify_connect()の戻り値がRTC_OKであれば、 RTC_OK を返す。この時点で接続は完了する。RTC_OK以外 の場合は、この接続IDに対してdisconnect()を呼び出し接続を解除し、 notify_connect() が返したエラーリターンコードをそのまま返す。
connect() の引数として渡した ConnectorProfile には、 ConnectorProfile::connector_id および、途中のポートが publishInterfaces() で公開したポートインターフェースの各種情報が 格納されている。connect() および途中の notify_connect() が ConnectorProfile::{name, ports} を変更することはない。
引数:
connector_profile ConnectorProfile
戻り値:
ReturnCode_t 型のリターンコード

RTC::InPortBase, と RTC::OutPortBaseで再定義されています。

virtual ReturnCode_t RTC::PortBase::connectNext ( ConnectorProfile &  connector_profile  )  [protected, virtual]

次の Port に対して notify_connect() をコールする

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

引数:
connector_profile 接続に関するプロファイル情報
戻り値:
ReturnCode_t 型のリターンコード
virtual void RTC::PortBase::deactivateInterfaces (  )  [pure virtual]

全ての Port のインターフェースを deactivates する

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

RTC::CorbaPort, RTC::InPortBase, と RTC::OutPortBaseで実装されています。

bool RTC::PortBase::deleteInterface ( const char *  name,
PortInterfacePolarity  pol 
) [protected]

PortInterfaceProfile からインターフェース登録を削除する.

このオペレーションは Port が持つ PortProfile の、PortInterfaceProfile からインターフェースの情報を削除する。

引数:
name インターフェースのインスタンスの名前
pol インターフェースの属性 (RTC::PROVIDED もしくは RTC:REQUIRED)
戻り値:
インターフェース削除処理結果。 インターフェースが登録されていなければ false を返す。
virtual ReturnCode_t RTC::PortBase::disconnect ( const char *  connector_id  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] Port の接続を解除する

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

事前条件:
connector_id は Port が保持する ConnectorProfile の少なくと も一つの ID に一致する文字列でなければならない。当該 Port が持つ ConnectorProfile のリスト内に connector_id と同一の ID を持つ ConnectorProfile が存在しなければこの関数は BAD_PARAMETER エラー を返す。
connector_id と同じ ID を持つ ConnectorProfile::ports には 有効な Port の参照が含まれていなければならない。
事後条件:
disconnect() 関数は、ConnectorProfileports の Port の参 照リストの先頭に対して、notify_disconnect() を呼び出す。参照が無 効であるなど、notify_disconnect() の呼び出しに失敗した場合には、 参照リストの先頭から順番に成功するまで notify_disconnect() の呼 び出しを試す。notify_disconnect() の呼び出しに一つでも成功すれば、 notify_disconnect() の返却値をそのまま返し、一つも成功しなかった 場合には RTC_ERROR エラーを返す。
引数:
connector_id ConnectorProfile の ID
戻り値:
ReturnCode_t 型のリターンコード

参照元 RTC::OutPort< DataType >::write().

virtual ReturnCode_t RTC::PortBase::disconnect_all (  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] Port の全接続を解除する

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

戻り値:
ReturnCode_t 型のリターンコード
virtual ReturnCode_t RTC::PortBase::disconnectNext ( ConnectorProfile &  connector_profile  )  [protected, virtual]

次の Port に対して notify_disconnect() をコールする

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

引数:
connector_profile 接続に関するプロファイル情報
戻り値:
ReturnCode_t 型のリターンコード
bool RTC::PortBase::eraseConnectorProfile ( const char *  id  )  [protected]

ConnectorProfile を削除する.

このオペレーションは Port の PortProfile が保持している ConnectorProfileList のうち与えられた id を持つ ConnectorProfile を削除する。

引数:
id 削除する ConnectorProfile の id
戻り値:
正常に削除できた場合は true、 指定した ConnectorProfile が見つからない場合は false を返す
ConnectorProfile RTC::PortBase::findConnProfile ( const char *  id  )  [protected]

id を持つ ConnectorProfile を探す

このオペレーションは与えられた ID を持つ ConnectorProfile を Port が もつ ConnectorProfile のリスト中から探す。 もし、同一の id を持つ ConnectorProfile がなければ、空の ConnectorProfile が返される。

引数:
id 検索する connector_id
戻り値:
connector_id を持つ ConnectorProfile

参照元 RTC::OutPort< DataType >::write().

CORBA::Long RTC::PortBase::findConnProfileIndex ( const char *  id  )  [protected]

id を持つ ConnectorProfile を探す

このオペレーションは与えられた ID を持つ ConnectorProfile を Port が もつ ConnectorProfile のリスト中から探しインデックスを返す。 もし、同一の id を持つ ConnectorProfile がなければ、-1 を返す。

引数:
id 検索する connector_id
戻り値:
Port の ConnectorProfile リストのインデックス
virtual ConnectorProfile* RTC::PortBase::get_connector_profile ( const char *  connector_id  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] ConnectorProfile を取得する

connector_id で指定された ConnectorProfile を返す。この関数は CORBA オペレーションであり、CORBA のメモリ管理規則に従い、呼び出 し側は返される ConnectorProfile オブジェクトを解体する責任がある。

事前条件:
引数に与える connector_id は有効な文字列でなければならない。 空文字を指定した場合、または指定した connector_id を持つ ConnectorProfile が見つからない場合は、空の ConnectorProfile を 返す。
事後条件:
この関数を呼び出すことにより内部状態が変更されることはない。
引数:
connector_id ConnectorProfile の ID
戻り値:
connector_id で指定された ConnectorProfile
virtual ConnectorProfileList* RTC::PortBase::get_connector_profiles (  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] ConnectorProfileListを取得する

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

ConnectorProfile は Port 間の接続プロファイル情報を保持する構造体であり、 接続時にPort間で情報交換を行い、関連するすべての Port で同一の値が 保持される。 ConnectorProfile は以下のメンバーを保持している。

  • name [string 型] このコネクタの名前。
  • connector_id [string 型] ユニークなID
  • ports [Port sequnce] このコネクタに関連する Port のオブジェクト リファレンスのシーケンス。
  • properties [NVList 型] その他のプロパティ。
事後条件:
この関数を呼び出すことにより内部状態が変更されることはない。
戻り値:
この Port が保持する ConnectorProfile
virtual PortProfile* RTC::PortBase::get_port_profile (  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] PortProfileを取得する

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

  • name [string 型] Port の名前。
  • interfaces [PortInterfaceProfileList 型] Port が保持する PortInterfaceProfile のシーケンス
  • port_ref [Port Object 型] Port 自身のオブジェクトリファレンス
  • connector_profile [ConnectorProfileList 型] Port が現在保持する ConnectorProfile のシーケンス
  • owner [RTObject Object 型] この Port を所有する RTObjectのリファレンス
  • properties [NVList 型] その他のプロパティ。
事後条件:
この関数を呼び出すことにより内部状態が変更されることはない。
戻り値:
PortProfile
const char* RTC::PortBase::getName (  )  const

Port の名前を取得する.

Port の名前を取得する。

戻り値:
Port の名前
const PortProfile& RTC::PortBase::getPortProfile (  )  const

PortProfile を取得する。.

この関数は、オブジェクト内部に保持されている PortProfile の const 参照を返す const 関数である。

事後条件:
この関数を呼び出すことにより内部状態が変更されることはない。
戻り値:
PortProfile
PortService_ptr RTC::PortBase::getPortRef (  ) 

Port のオブジェクト参照を取得する.

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

戻り値:
この Port のオブジェクト参照
const PortProfile& RTC::PortBase::getProfile (  )  const

PortProfileを取得する.

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

戻り値:
この Port の PortProfile
const std::string RTC::PortBase::getUUID (  )  const [protected]

UUIDを生成する.

このオペレーションは UUID を生成する。

戻り値:
uuid
bool RTC::PortBase::isEmptyId ( const ConnectorProfile &  connector_profile  )  const [protected]

ConnectorProfile の connector_id フィールドが空かどうか判定.

指定された ConnectorProfile の connector_id が空であるかどうかの判定を 行う。

引数:
connector_profile 判定対象コネクタプロファイル
戻り値:
引数で与えられた ConnectorProfile の connector_id が空であれば、 true、そうでなければ false を返す。
bool RTC::PortBase::isExistingConnId ( const char *  id  )  [protected]

id が既存の ConnectorProfile のものかどうか判定する

このオペレーションは与えられた ID が既存の ConnectorProfile のリスト中に 存在するかどうか判定する。

引数:
id 判定する connector_id
戻り値:
id の存在判定結果
virtual ReturnCode_t RTC::PortBase::notify_connect ( ConnectorProfile &  connector_profile  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] Port の接続通知を行う

このオペレーションは、Port間の接続が行われる際に、Port間で内部的 に呼ばれるオペレーションであって、通常アプリケーションプログラム や、Port以外のRTC関連オブジェクト等から呼び出されることは想定さ れていない。

notify_connect() 自体はテンプレートメソッドパターンとして、サブ クラスで実装されることが前提の publishInterfaces(), subscribeInterfaces() の2つの関数を内部で呼び出す。処理の手順は 以下の通りである。

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 に伝えるために、プロパティ情報が書き込まれる。
なお、ConnectorProfileports のリストの最初 Port の notify_connet() が終了した時点では、すべての関連する Port の notify_connect() の呼び出しが完了する。publishInterfaces(), connectNext(), subscribeInterfaces() および接続情報の保存のいず れかの段階でエラーが発生した場合でも、エラーコードは内部的に保持 されており、最初に生じたエラーのエラーコードが返される。
引数:
connector_profile ConnectorProfile
戻り値:
ReturnCode_t 型のリターンコード
virtual ReturnCode_t RTC::PortBase::notify_disconnect ( const char *  connector_id  )  throw (CORBA::SystemException) [virtual]

[CORBA interface] Port の接続解除通知を行う

このオペレーションは、Port間の接続解除が行われる際に、Port間で内 部的に呼ばれるオペレーションであり、通常アプリケーションプログラ ムや、 Port 以外の RTC 関連オブジェクト等から呼び出されることは 想定されていない。

notify_disconnect() 自体はテンプレートメソッドパターンとして、サ ブクラスで実装されることが前提の unsubscribeInterfaces() 関数を 内部で呼び出す。処理の手順は以下の通りである。

notify_disconnect() は ConnectorProfile::ports に格納されている Port の順序に従って、カスケード状に呼び出しを行うことにより、接 続の解除をすべての Port に通知する。

事前条件:
Port は与えられた connector_id に対応する ConnectorProfile を保持していなければならない。
事後条件:
connector_id に対応する ConnectorProfile が見つからない場 合はBAD_PARAMETER エラーを返す。
カスケード呼び出しを行う際には ConnectorProfile::ports に 保持されている Port の参照リストのうち、自身の参照の次の参照に対 して notify_disconnect() を呼び出すが、その呼び出しで例外が発生 した場合には、呼び出しをスキップしリストの次の参照に対して notify_disconnect() を呼び出す。一つも呼び出しに成功しない場合、 RTC_ERROR エラーコードを返す。
なお、ConnectorProfileports のリストの最初 Port の notify_disconnet() が終了した時点では、すべての関連する Port の notify_disconnect() の呼び出しが完了する。
引数:
connector_id ConnectorProfile の ID
戻り値:
ReturnCode_t 型のリターンコード
void RTC::PortBase::onConnected ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onConnectNextport ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onDisconnected ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onDisconnectNextport ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onNotifyConnect ( const char *  portname,
RTC::ConnectorProfile &  profile 
) [inline, protected]
void RTC::PortBase::onNotifyDisconnect ( const char *  portname,
RTC::ConnectorProfile &  profile 
) [inline, protected]
void RTC::PortBase::onPublishInterfaces ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onSubscribeInterfaces ( const char *  portname,
RTC::ConnectorProfile &  profile,
ReturnCode_t  ret 
) [inline, protected]
void RTC::PortBase::onUnsubscribeInterfaces ( const char *  portname,
RTC::ConnectorProfile &  profile 
) [inline, protected]
virtual ReturnCode_t RTC::PortBase::publishInterfaces ( ConnectorProfile &  connector_profile  )  [protected, pure virtual]

Interface 情報を公開する.

このオペレーションは、notify_connect() 処理シーケンスの始めにコール される純粋仮想関数である。 notify_connect() では、

の順に protected 関数がコールされ接続処理が行われる。
具象 Port ではこのオペレーションをオーバーライドし、引数として 与えられた ConnectorProfile に従い処理を行い、パラメータが不適切 であれば、RteurnCode_t 型のエラーコードを返す。 通常 publishInterafaces() 内においては、この Port に属する インターフェースに関する情報を ConnectorProfile に対して適切に設定し 他の Port に通知しなければならない。
また、この関数がコールされる段階では、他の Port の Interface に関する 情報はすべて含まれていないので、他の Port の Interface を取得する処理 は subscribeInterfaces() 内で行われるべきである。
このオペレーションは、新規の connector_id に対しては接続の生成、 既存の connector_id に対しては更新が適切に行われる必要がある。

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

RTC::CorbaPort, RTC::InPortBase, と RTC::OutPortBaseで実装されています。

virtual void RTC::PortBase::setConnectionLimit ( int  limit_value  )  [protected, virtual]

接続の最大数を設定する。

引数:
limit_value 最大数
void RTC::PortBase::setName ( const char *  name  ) 

Port の名前を設定する.

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

引数:
name Port の名前
void RTC::PortBase::setOnConnected ( ConnectionCallback on_connected  ) 

接続完了時に呼ばれるコールバックをセットする

このオペレーションは、このポートが接続完了時に呼ばれる、コールバッ クファンクタをセットする。

コールバックファンクタの所有権は、呼び出し側にあり、オブジェクト が必要なくなった時に解体するのは呼び出し側の責任である。

このコールバックファンクタは、ポートの接続実行関数である notify_connect() の終了直前に、接続処理が正常終了する際に限って 呼び出されるコールバックである。接続処理の過程でエラーが発生した 場合には呼び出されない。

このコールバックファンクタは notify_connect() が out パラメータ として返すのと同じ引数 ConnectorProfile とともに呼び出されるので、 この接続において公開されたすべてのインターフェース情報を得ること ができる。このコールバックを利用して、notify_connect() が返す ConnectorProfile を変更することが可能であるが、接続関係の不整合 を招かないよう、ConnectorProfile の変更には注意を要する。

引数:
on_subscribe ConnectionCallback のサブクラスオブジェクトのポインタ
void RTC::PortBase::setOnConnectionLost ( ConnectionCallback on_connection_lost  ) 

ポートの接続がロストした場合に呼び出されるコールバックをセットする

このオペレーションは、このポートの接続がロストした場合に呼ばれる、 コールバックファンクタをセットする。

InPortは、相手側OutPortとの 接続をロストした場合、接続を強制的に切断するので、 引き続き OnDisconnect コールバックが呼び出される。

引数:
on_connection_lost ConnectionCallback のサブクラスオブジェク トのポインタ
void RTC::PortBase::setOnDisconnected ( ConnectionCallback on_disconnected  ) 

接続解除に呼ばれるコールバックをセットする

このオペレーションは、このポートの接続解除時に呼ばれる、コールバッ クファンクタをセットする。

コールバックファンクタの所有権は、呼び出し側にあり、オブジェクト が必要なくなった時に解体するのは呼び出し側の責任である。

このコールバックファンクタは、ポートの接続解除実行関数である notify_disconnect() の終了直前に、呼び出されるコールバックである。

このコールバックファンクタは接続に対応する ConnectorProfile とと もに呼び出される。この ConnectorProfile はこのファンクタ呼出し後 に破棄されるので、変更がほかに影響を与えることはない。

引数:
on_disconnected ConnectionCallback のサブクラスオブジェク トのポインタ
void RTC::PortBase::setOnPublishInterfaces ( ConnectionCallback on_publish  ) 

インターフェースを公開する際に呼ばれるコールバックをセットする

このオペレーションは、このポートが接続時に、ポート自身が持つサー ビスインターフェース情報を公開するタイミングで呼ばれるコールバッ クファンクタをセットする。

コールバックファンクタの所有権は、呼び出し側にあり、オブジェクト が必要なくなった時に解体するのは呼び出し側の責任である。

このコールバックファンクタは、PortBaseクラスの仮想関数である publishInterfaces() が呼ばれたあとに、同じ引数 ConnectorProfile と ともに呼び出される。このコールバックを利用して、 publishInterfaces() が公開した ConnectorProfile を変更することが可 能であるが、接続関係の不整合を招かないよう、ConnectorProfile の 変更には注意を要する。

引数:
on_publish ConnectionCallback のサブクラスオブジェクトのポインタ
void RTC::PortBase::setOnSubscribeInterfaces ( ConnectionCallback on_subscribe  ) 

インターフェースを取得する際に呼ばれるコールバックをセットする

このオペレーションは、このポートが接続時に、相手のポートが持つサー ビスインターフェース情報を取得するタイミングで呼ばれるコールバッ クファンクタをセットする。

コールバックファンクタの所有権は、呼び出し側にあり、オブジェクト が必要なくなった時に解体するのは呼び出し側の責任である。

このコールバックファンクタは、PortBaseクラスの仮想関数である subscribeInterfaces() が呼ばれる前に、同じ引数 ConnectorProfile と ともに呼び出される。このコールバックを利用して、 subscribeInterfaces() に与える ConnectorProfile を変更することが可 能であるが、接続関係の不整合を招かないよう、ConnectorProfile の 変更には注意を要する。

引数:
on_subscribe ConnectionCallback のサブクラスオブジェクトのポインタ
void RTC::PortBase::setOnUnsubscribeInterfaces ( ConnectionCallback on_subscribe  ) 

インターフェースを解放する際に呼ばれるコールバックをセットする

このオペレーションは、このポートが接続時に、相手のポートが持つサー ビスインターフェース情報を解放するタイミングで呼ばれるコールバッ クファンクタをセットする。

コールバックファンクタの所有権は、呼び出し側にあり、オブジェクト が必要なくなった時に解体するのは呼び出し側の責任である。

このコールバックファンクタは、PortBaseクラスの仮想関数である unsubscribeInterfaces() が呼ばれる前に、同じ引数 ConnectorProfile と ともに呼び出される。このコールバックを利用して、 unsubscribeInterfaces() に与える ConnectorProfile を変更することが可 能であるが、接続関係の不整合を招かないよう、ConnectorProfile の 変更には注意を要する。

引数:
on_unsubscribe ConnectionCallback のサブクラスオブジェク トのポインタ
void RTC::PortBase::setOwner ( RTObject_ptr  owner  ) 

Port の owner の RTObject を指定する.

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

引数:
owner この Port を所有する RTObject の参照
void RTC::PortBase::setPortConnectListenerHolder ( PortConnectListeners portconnListeners  ) 

PortConnectListeners のホルダをセットする.

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

引数:
portconnListeners PortConnectListeners オブジェクトのポインタ
void RTC::PortBase::setPortRef ( PortService_ptr  port_ref  ) 

Port のオブジェクト参照を設定する.

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

引数:
port_ref この Port のオブジェクト参照
void RTC::PortBase::setUUID ( ConnectorProfile &  connector_profile  )  const [protected]

UUIDを生成し ConnectorProfile にセットする.

このオペレーションは UUID を生成し、ConnectorProfile にセットする。

引数:
connector_profile connector_id をセットする ConnectorProfile
virtual ReturnCode_t RTC::PortBase::subscribeInterfaces ( const ConnectorProfile &  connector_profile  )  [protected, pure virtual]

Interface 情報を公開する.

このオペレーションは、notify_connect() 処理シーケンスの中間にコール される純粋仮想関数である。 notify_connect() では、

の順に protected 関数がコールされ接続処理が行われる。
具象 Port ではこのオペレーションをオーバーライドし、引数として 与えられた ConnectorProfile に従い処理を行い、パラメータが不適切 であれば、RteurnCode_t 型のエラーコードを返す。 引数 ConnectorProfile には他の Port の Interface に関する情報が 全て含まれている。 通常 subscribeInterafaces() 内においては、この Port が使用する Interface に関する情報を取得し、要求側のインターフェースに対して 情報を設定しなければならない。
このオペレーションは、新規の connector_id に対しては接続の生成、 既存の connector_id に対しては更新が適切に行われる必要がある。

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

RTC::CorbaPort, RTC::InPortBase, と RTC::OutPortBaseで実装されています。

virtual void RTC::PortBase::unsubscribeInterfaces ( const ConnectorProfile &  connector_profile  )  [protected, pure virtual]

Interface の接続を解除する.

このオペレーションは、notify_disconnect() 処理シーケンスの終わりにコール される純粋仮想関数である。 notify_disconnect() では、

  • disconnectNext()
  • unsubscribeInterfaces()
  • eraseConnectorProfile() の順に protected 関数がコールされ接続解除処理が行われる。
    具象 Port ではこのオペレーションをオーバーライドし、引数として 与えられた ConnectorProfile に従い接続解除処理を行う。
引数:
connector_profile 接続に関するプロファイル情報

RTC::CorbaPort, RTC::InPortBase, と RTC::OutPortBaseで実装されています。

void RTC::PortBase::updateConnectorProfile ( const ConnectorProfile &  connector_profile  )  [protected]

ConnectorProfile の追加もしくは更新.

このオペレーションは与えられた ConnectorProfile を Port に追加もしくは 更新保存する。 与えられた ConnectorProfile の connector_id と同じ ID を持つ ConnectorProfile がリストになければ、リストに追加し、 同じ ID が存在すれば ConnectorProfile を上書き保存する。

引数:
connector_profile 追加もしくは更新する ConnectorProfile
void RTC::PortBase::updateConnectors (  )  [protected]

存在しないポートをdisconnectする。

死んだPortを検出し、もし死んでいるポートがあった場合には、接続を 解除する。


変数

Port の接続の最大数.

RTC::PortService_var RTC::PortBase::m_objref [protected]

Port の オブジェクト参照.

Callback functor オブジェクト.

接続完了時に呼ばれるコールバックオブジェクト

Callback functor オブジェクト.

ポートの接続がロストした場合に呼び出されるコールバックオブジェクト

参照元 RTC::OutPort< DataType >::write().

Callback functor オブジェクト.

接続解除に呼ばれるコールバックオブジェクト

Callback functor オブジェクト.

インターフェースを公開する際に呼ばれるコールバックオブジェクト

Callback functor オブジェクト.

インターフェースを取得する際に呼ばれるコールバックオブジェクト

Callback functor オブジェクト.

インターフェースを解放する際に呼ばれるコールバックオブジェクト

std::string RTC::PortBase::m_ownerInstanceName [protected]

インスタンス名

PortProfile RTC::PortBase::m_profile [protected]

Port の PortProfile.

参照元 addProperty(), と appendProperty().

PortProfile の mutex.

Logger RTC::PortBase::rtclog [mutable, protected]

ロガーストリーム

OpenRTMに対してThu May 24 23:25:20 2012に生成されました。  doxygen 1.6.3