Interstage Application Server アプリケーション作成ガイド (CORBAサービス編)
目次 索引 前ページ次ページ

第4章 アプリケーションの開発(C++言語)> 4.1 クライアントアプリケーションのプログラミング> 4.1.1 静的起動インタフェース

4.1.1.3 サーバアプリケーションのオブジェクトリファレンスの獲得

 ネーミングサービスのメソッドCosNaming::NamingContext::resolve()により、これから実行したいサーバアプリケーションのオブジェクトリファレンスを取り出します。検索したいオブジェクト名を当メソッドのパラメタとして指定します。

  CosNaming::Name               name;             // CosNaming::Nameのインスタンス
  CORBA::Object_ptr          obj; // サーバアプリケーションのオブジェクトリファレンス

  name.length(1);
  // オブジェクト名
  name[0]->id = (const CORBA::Char *)"ODdemo::calculator";
  // オブジェクトのタイプ
  name[0]->kind = (const CORBA::Char *)"";
  name_component[0]->kind = (const CORBA::Char *)""; 

  // サーバアプリケーションのオブジェクトリファレンスを獲得
  obj = cos_naming-> resolve( name, env );

  // ODdemo::calculatorクラスへの変換
  ODdemo::calculator_ptr ap = ODdemo::calculator::_narrow( obj );

目次 索引 前ページ次ページ

Copyright 2005 FUJITSU LIMITED