イベントチャネルに接続する際、自身のオブジェクトを登録します。このオブジェクトの生成方法(コンシューマのオブジェクトの作成例)を以下に示します。
イベントサービスの場合
[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 );
ノーティフィケーションサービスの場合
[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_PushConsumer、ノーティフィケーションサービスの場合は_INTF_CosEventComm_PullConsumer)、インプリメンテーション情報には自身のインプリメンテーションリポジトリIDを指定します。
各アプリケーションが実装するインタフェースを以下に示します。アプリケーションは、インタフェースリポジトリIDを、CORBA::Repository::lookup_idに以下のパラメタを指定して獲得します。
イベントサービスの場合
通信モデル | サプライヤ | コンシューマ |
---|---|---|
Push | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PushConsumer |
Pull | _INTF_CosEventComm_PullSupplier | _INTF_CosEventComm_PullConsumer |
Mixed | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PullConsumer |
ノーティフィケーションサービスの場合
通信モデル | サプライヤ | コンシューマ |
---|---|---|
Mixed | _INTF_CosEventComm_PushSupplier | _INTF_CosEventComm_PullConsumer |
Mixed | _INTF_CosNotifyComm_StructuredPushSupplier | _INTF_CosNotifyComm_StructuredPullConsumer |