メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ

クラス RTC::CorbaPort

RT コンポーネント CORBA service/consumer 用 Port. [詳細]

#include <CorbaPort.h>

RTC::CorbaPortに対する継承グラフ

RTC::PortBase すべてのメンバ一覧

Public メソッド

 CorbaPort (const char *name)
 コンストラクタ
virtual ~CorbaPort ()
 デストラクタ
bool registerProvider (const char *instance_name, const char *type_name, PortableServer::RefCountServantBase &provider)
 Provider を登録する.
bool registerConsumer (const char *instance_name, const char *type_name, CorbaConsumerBase &consumer)
 Consumer を登録する.
virtual PortProfile * get_port_profile ()
 [CORBA interface] PortProfileを取得する
const PortProfile & getPortProfile () const
virtual ConnectorProfileList * get_connector_profiles ()
 [CORBA interface] ConnectorProfileListを取得する
virtual ConnectorProfile * get_connector_profile (const char *connector_id)
 [CORBA interface] ConnectorProfile を取得する
virtual ReturnCode_t connect (ConnectorProfile &connector_profile)
 [CORBA interface] Port の接続を行う
virtual ReturnCode_t notify_connect (ConnectorProfile &connector_profile)
 [CORBA interface] Port の接続通知を行う
virtual ReturnCode_t disconnect (const char *connector_id)
 [CORBA interface] Port の接続を解除する
virtual ReturnCode_t notify_disconnect (const char *connector_id)
 [CORBA interface] Port の接続解除通知を行う
virtual ReturnCode_t disconnect_all ()
 [CORBA interface] Port の全接続を解除する
void setName (const char *name)
 Port の名前を設定する.
const PortProfile & getProfile () const
 PortProfileを取得する.
void setPortRef (Port_ptr port_ref)
 Port のオブジェクト参照を設定する.
Port_ptr getPortRef ()
 Port のオブジェクト参照を取得する.
void setOwner (RTObject_ptr owner)
 Port の owner の RTObject を指定する.

Protected 型

typedef ACE_Guard< ACE_Recursive_Thread_Mutex > Guard

Protected メソッド

virtual ReturnCode_t publishInterfaces (ConnectorProfile &connector_profile)
 Interface 情報を公開する.
virtual ReturnCode_t subscribeInterfaces (const ConnectorProfile &connector_profile)
 Interface に接続する.
virtual void unsubscribeInterfaces (const ConnectorProfile &connector_profile)
 Interface への接続を解除する.
virtual ReturnCode_t connectNext (ConnectorProfile &connector_profile)
 次の Port に対して notify_connect() をコールする
virtual ReturnCode_t disconnectNext (ConnectorProfile &connector_profile)
 次の Port に対して notify_disconnect() をコールする
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 値を追加する.

Protected 変数

PortProfile m_profile
 Port の PortProfile.
RTC::Port_var m_objref
ACE_Recursive_Thread_Mutex m_profile_mutex

構成

struct  Consumer
 Consumer の情報を格納する構造体.
struct  subscribe
 ConnectorProfile と Consuemr の比較をしオブジェクト参照を セットするための Functor.
struct  unsubscribe
 Consumer のオブジェクトを解放するための Functor.

説明

RT コンポーネント CORBA service/consumer 用 Port.

CorbaPort は RT コンポーネントにおいて、ユーザ定義の CORBA オブジェクト サービスおよびコンシューマを提供する Port 実装である。

RT コンポーネントは、Port を介してユーザが定義した CORBA サービスを提供 することができ、これを RT Service (Provider) と呼ぶ。 また、他の RT コンポーネントのサービスを利用するための CORBA オブジェクト のプレースホルダを提供することができ、これを RT Service Consumer と呼ぶ。

CorbaPort は任意の数の Provider および Consumer を管理することができ、 Port 同士を接続する際に対応する Provider と Consumer を適切に関連付ける ことができる。

CorbaPort は通常以下のように利用される。

 RTC::CorbaPort m_port0; // Port の宣言

 MyService_impl m_mysvc0; // この Port が提供する Serivce Provider
 RTC::CorbaConsumer<YourService> m_cons0; // この Port の Consumer

 // Service Provider を Port に登録
 m_port0.registerProvider("MyService0", "Generic", m_mysvc0);
 // Service Consumer を Port に登録
 m_port0.registerConsumer("YourService0", "Generic", m_cons0 );

 // connect が行われた後

 m_cons0->your_service_function(); // YourService の関数をコール

 // connect された 別のコンポーネントにおいて
 m_cons1->my_service_function(); // MyService の関数をコール
 

このように、提供したい Service Provider を registerProvider() で登録 することにより、他のコンポーネントから利用可能にし、他方、 利用したい Service Consumer を registerConsumer() で登録することにより 他のコンポーネントの Service をコンポーネント内で利用可能にすることが できる。


型定義

typedef ACE_Guard<ACE_Recursive_Thread_Mutex> RTC::PortBase::Guard [protected, inherited]
 


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

RTC::CorbaPort::CorbaPort const char *  name  ) 
 

コンストラクタ

引数:
name Port の名前

virtual RTC::CorbaPort::~CorbaPort  )  [virtual]
 

デストラクタ


関数

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

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

引数:
ValueType properties の value に追加する値の型
key properties の name
value properties の value

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

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

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

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

引数:
name インターフェースのインスタンスの名前
type_name インターフェースの型の名前
pol インターフェースの属性 (RTC::PROVIDED もしくは RTC:REQUIRED)
戻り値:
同名のインターフェースが既に登録されていれば false を返す。

virtual ReturnCode_t RTC::PortBase::connect ConnectorProfile &  connector_profile  )  [virtual, inherited]
 

[CORBA interface] Port の接続を行う

与えられた ConnectoionProfile にしたがって、Port間の接続を確立する。 アプリケーションプログラム側は、幾つかのコンポーネントが持つ複数の Port を接続したい場合、適切な値をセットした ConnectorProfile を connect() の引数として与えてコールすることにより、関連する Port の 接続を確立する。

connect() に与える ConnectorProfile のメンバーのうち、name, ports, (properties) メンバーに対してデータをセットしなければならない。

引数:
connector_profile ConnectorProfile
戻り値:
ReturnCode_t オペレーションのリターンコード

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

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

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

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

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

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

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

引数:
name インターフェースのインスタンスの名前
pol インターフェースの属性 (RTC::PROVIDED もしくは RTC:REQUIRED)
戻り値:
インターフェースが登録されていなければ false を返す。

virtual ReturnCode_t RTC::PortBase::disconnect const char *  connector_id  )  [virtual, inherited]
 

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

このオペレーションは接続確立時に接続に対して与えられる connector_id に 対応するピア Port との接続を解除する。

引数:
connector_id ConnectorProfile の ID
戻り値:
ReturnCode_t オペレーションのリターンコード

virtual ReturnCode_t RTC::PortBase::disconnect_all  )  [virtual, inherited]
 

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

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

戻り値:
ReturnCode_t オペレーションのリターンコード

virtual ReturnCode_t RTC::PortBase::disconnectNext ConnectorProfile &  connector_profile  )  [protected, virtual, inherited]
 

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

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

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

bool RTC::PortBase::eraseConnectorProfile const char *  id  )  [protected, inherited]
 

ConnectorProfile を削除する.

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

引数:
id 削除する ConnectorProfile の id

ConnectorProfile RTC::PortBase::findConnProfile const char *  id  )  [protected, inherited]
 

id を持つ ConnectorProfile を探す

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

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

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

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  )  [virtual, inherited]
 

[CORBA interface] ConnectorProfile を取得する

connector_id で指定された ConnectorProfile を返す。

引数:
connector_id ConnectorProfile の ID
戻り値:
connector_id を持つ ConnectorProfile

virtual ConnectorProfileList* RTC::PortBase::get_connector_profiles  )  [virtual, inherited]
 

[CORBA interface] ConnectorProfileListを取得する

Portが保持する ConnectorProfile の sequence を返す。 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  )  [virtual, inherited]
 

[CORBA interface] PortProfileを取得する

Portが保持する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 型] その他のプロパティ。

戻り値:
この Port の PortProfile

const PortProfile& RTC::PortBase::getPortProfile  )  const [inherited]
 

Port_ptr RTC::PortBase::getPortRef  )  [inherited]
 

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

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

戻り値:
この Port のオブジェクト参照

const PortProfile& RTC::PortBase::getProfile  )  const [inherited]
 

PortProfileを取得する.

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

戻り値:
この Port の PortProfile

const std::string RTC::PortBase::getUUID  )  const [protected, inherited]
 

UUIDを生成する.

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

戻り値:
uuid

bool RTC::PortBase::isEmptyId const ConnectorProfile &  connector_profile  )  const [protected, inherited]
 

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

戻り値:
引数で与えられた ConnectorProfile の connector_id が空であれば、 true、そうでなければ false を返す。

bool RTC::PortBase::isExistingConnId const char *  id  )  [protected, inherited]
 

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

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

引数:
id 判定する connector_id

virtual ReturnCode_t RTC::PortBase::notify_connect ConnectorProfile &  connector_profile  )  [virtual, inherited]
 

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

このオペレーションは、Port間の接続が行われる際に、Port間で内部的に 呼ばれるオペレーションである。

引数:
connector_profile ConnectorProfile
戻り値:
ReturnCode_t オペレーションのリターンコード

virtual ReturnCode_t RTC::PortBase::notify_disconnect const char *  connector_id  )  [virtual, inherited]
 

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

このオペレーションは、Port間の接続解除が行われる際に、Port間で内部的に 呼ばれるオペレーションである。

引数:
connector_id ConnectorProfile の ID
戻り値:
ReturnCode_t オペレーションのリターンコード

virtual ReturnCode_t RTC::CorbaPort::publishInterfaces ConnectorProfile &  connector_profile  )  [protected, virtual]
 

Interface 情報を公開する.

この Portが所有する Provider に関する情報を ConnectorProfile::properties に代入する。 代入する情報は、NVListの name と value として以下のものが格納される。

  • port.<type_name>.<instance_name>: <CORBA::Object_ptr>

ここで、

  • <type_name>: PortInterfaceProfile::type_name
  • <instance_name>: PortInterfaceProfile::instance_name である。 ConnectorProfile::properties では、これらを .(ドット)表記で、 NameValue のキーとしている。したがって、

  PortInterfaceProfile
  {
    instance_name = "PA10_0";
    type_name     = "Manipulator";
    polarity      = PROVIDED;
  }
     *

ならば、

 NameValue = { "port.Manipulator.PA10_0": <object reference=""> }
 

といった値が ConnectorProfile::properties に格納され、他のポートに対して 伝達される。他の Port でこのインターフェースを使用する Consumer が 存在すれば、ConnectorProfile からこのキーからオブジェクトリファレンスを 取得し何らかの形で使用される。

RTC::PortBaseを実装しています.

bool RTC::CorbaPort::registerConsumer const char *  instance_name,
const char *  type_name,
CorbaConsumerBase consumer
 

Consumer を登録する.

この Port が要求するサービスのプレースホルダであるコンシューマ (Consumer) を登録する。 Consumer が関連付けられるサービスのインスタンス名およびタイプ名として、 引数に instance_name, type_name および Consumer 自身を与えることにより、 内部でこれらが関連付けられる。 Port 間の接続 (connect) 時 には、同一の instance_name, type_name を持つ サービスが他の Port から提供 (Provide) されている場合、そのサービスの オブジェクト参照が自動的に Consumer にセットされる。

引数:
instance_name Consumer が要求するサービスのインスタンス名
type_name Consumer が要求するサービスのタイプ名
consumer CORBA サービスコンシューマ
戻り値:
既に同名の instance_name が登録されていれば false を返す。

bool RTC::CorbaPort::registerProvider const char *  instance_name,
const char *  type_name,
PortableServer::RefCountServantBase &  provider
 

Provider を登録する.

この Port において提供したいサーバントをこの Port に対して登録する。 サーバントは、引数で与えられる instance_name, type_name を、 サーバント自身のインスタンス名およびタイプ名として、サーバントに 関連付けられる。

引数:
instance_name サーバントのインスタンス名
type_name サーバントのタイプ名
provider CORBA サーバント
戻り値:
既に同名の instance_name が登録されていれば false を返す。

void RTC::PortBase::setName const char *  name  )  [inherited]
 

Port の名前を設定する.

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

引数:
name Port の名前

void RTC::PortBase::setOwner RTObject_ptr  owner  )  [inherited]
 

Port の owner の RTObject を指定する.

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

引数:
owner この Port を所有する RTObject の参照

void RTC::PortBase::setPortRef Port_ptr  port_ref  )  [inherited]
 

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

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

引数:
この Port のオブジェクト参照

void RTC::PortBase::setUUID ConnectorProfile &  connector_profile  )  const [protected, inherited]
 

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

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

引数:
connector_profile connector_id をセットする ConnectorProfile

virtual ReturnCode_t RTC::CorbaPort::subscribeInterfaces const ConnectorProfile &  connector_profile  )  [protected, virtual]
 

Interface に接続する.

この Portが所有する Consumer に適合する Provider に関する情報を ConnectorProfile::properties から抽出し Consumer にオブジェクト参照 をセットする。

今、Consumer が

  PortInterfaceProfile
  {
    instance_name = "PA10_0";
    type_name     = "Manipulator";
    polarity      = REQUIRED;
  }
     *
として登録されていれば、他の Port の
  PortInterfaceProfile
  {
    instance_name = "PA10_0";
    type_name     = "Manipulator";
    polarity      = PROVIDED;
  }
 
として登録されている Serivce Provider のオブジェクト参照を探し、 Consumer にセットする。 実際には、ConnectorProfile::properties に
 NameValue = { "port.Manipulator.PA10_0": <object reference=""> }
 
として登録されている NameValue を探し、そのオブジェクト参照を Consumer にセットする。

RTC::PortBaseを実装しています.

virtual void RTC::CorbaPort::unsubscribeInterfaces const ConnectorProfile &  connector_profile  )  [protected, virtual]
 

Interface への接続を解除する.

与えられた ConnectorProfile に関連する Consumer にセットされた すべての Object を解放し接続を解除する。

RTC::PortBaseを実装しています.

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

ConnectorProfile の追加もしくは更新.

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

引数:
coonector_profile 追加もしくは更新する ConnectorProfile


変数

RTC::Port_var RTC::PortBase::m_objref [protected, inherited]
 

PortProfile RTC::PortBase::m_profile [protected, inherited]
 

Port の PortProfile.

ACE_Recursive_Thread_Mutex RTC::PortBase::m_profile_mutex [mutable, protected, inherited]
 


このクラスの説明は次のファイルから生成されました:
OpenRTMに対してFri Oct 5 05:15:00 2007に生成されました。  doxygen 1.4.1