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

第5章 アプリケーションの開発(C++言語)> 5.3 サーバアプリケーションのプログラミング(Portable Object Adapter:POA)> 5.3.4 静的スケルトンインタフェース

5.3.4.4 インタフェースの実装

 IDLコンパイラで生成されたスケルトン(以下参照)内に定義してあるPOA_xxxクラス(xxxは、<モジュール名>_<インタフェース名>)を継承したxxx_implクラス(xxxは<モジュール名>_<インタフェース名>)内のオペレーションの実装を記述します。オペレーションのC++マッピング後のシグネチャは、yyy.hファイル(yyyはIDLファイル名)内の記述を参照することでわかります。

yyy_skel.cpp: yyyはIDLファイル名

yyy_skel_c++.C: yyyはIDLファイル名

注)この実装方法は、継承方式(Inheritance-Based Implementation)に基づくものです。代理方式(Delegation-Based Implementation)を使用する場合は、“サーバアプリケーションの実装アプローチ”を参照してください。

【IDL定義】

  module ODsample{
      interface intf{
          long add( in long a, in long b );
      };
  };

【スケルトン】

  class POA_ODsample_intf : public virtual PortableServer::ServantBase
  {
       :
   };

  class ODsample_intf_impl :  public virtual POA_ODsample_intf
  {
      public :
          CORBA::Long  add( ... );
         :
  };

【メソッドの実装】

  CORBA::Long  Odsample_intf_impl::add(
      CORBA::Long a,
      CORBA::Long b,
      CORBA::Environment& env )
      throw( CORBA::Exception )
  {
      return( a + b );
  }

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

All Rights Reserved, Copyright(C) 富士通株式会社 2005