イベントチャネルに接続する際、自身のオブジェクトを登録します。このオブジェクトの生成方法(コンシューマのオブジェクトの作成例)を以下に示します。
イベントサービスの場合
[Pushモデルのコンシューマのオブジェクト]
CORBA::ORB_ptr orb;
CORBA::BOA_ptr boa;
CORBA::Repository_ptr intf_rep;
CORBA::InterfaceDef_ptr intf;
CORBA::ImplementationDef_ptr impl;
CORBA::ReferenceData refid;
CORBA::Object_ptr obj;
CosEventComm::PushConsumer my_object;
obj = orb->resolve_initial_references(
CORBA_ORB_ObjectId_LightInterfaceRepository, env );
intf_rep = CORBA::Repository::_narrow( obj );
CORBA::release( obj );
obj = LightIntf->lookup_id(
_INTF_CosEventComm_PushConsumer, env );
intf = CORBA::InterfaceDef::_narrow( obj );
CORBA::release( obj );
obj = boa->create( refid, intf, impl, env );
my_object = CosEventComm::PushConsumer::_narrow( obj );
CORBA::release( obj );オブジェクトは、CORBA::BOA::createで作成します。
CORBA::BOA::createに指定するパラメタのインタフェースリポジトリIDには、自身が実装するインタフェースリポジトリID(INTF_CosEventComm_PushConsumer)を指定します。インプリメンテーション情報には、自身のインプリメンテーションリポジトリIDを指定します。
各アプリケーションが実装するインタフェースを以下に示します。アプリケーションは、CORBA::Repository::lookup_idに以下のパラメタを指定してインタフェースリポジトリIDを獲得します。
通信モデル | サプライヤ | コンシューマ |
|---|---|---|
Push | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PushConsumer |
Pull | _INTF_CosEventComm_PullSupplier | _INTF_CosEventComm_PullConsumer |
Mixed | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PullConsumer |
ノーティフィケーションサービスの場合
[Mixedモデルのコンシューマのオブジェクト]
CORBA::ORB_ptr orb;
CORBA::BOA_ptr boa;
CORBA::Repository_ptr intf_rep;
CORBA::InterfaceDef_ptr intf;
CORBA::ImplementationDef_ptr impl;
CORBA::ReferenceData refid;
CORBA::Object_ptr obj;
CosNotifyComm::PullConsumer my_object;
obj = orb->resolve_initial_references(
CORBA_ORB_ObjectId_LightInterfaceRepository, env );
intf_rep = CORBA::Repository::_narrow( obj );
CORBA::release( obj );
obj = LightIntf->lookup_id(
_INTF_CosEventComm_PullConsumer, env );
intf = CORBA::InterfaceDef::_narrow( obj );
CORBA::release( obj );
obj = boa->create( refid, intf, impl, env );
my_object = CosEventComm::PullConsumer::_narrow( obj );
CORBA::release( obj );オブジェクトは、CORBA::BOA::createで作成します。
CORBA::BOA::createに指定するパラメタのインタフェースリポジトリIDには自身が実装するインタフェースリポジトリID(_INTF_CosEventComm_PullConsumer)を指定します。インプリメンテーション情報には、自身のインプリメンテーションリポジトリIDを指定します。
各アプリケーションが実装するインタフェースを以下に示します。アプリケーションは、CORBA::Repository::lookup_idに以下のパラメタを指定してインタフェースリポジトリIDを獲得します。
通信モデル | サプライヤ | コンシューマ |
|---|---|---|
Mixed | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PullConsumer |
Mixed | _INTF_CosNotifyComm_StructuredPushSupplier | _INTF_CosNotifyComm_StructuredPullConsumer |