CPP实现CORBA静态绑定(二)

本文主要内容涉及:

  • CORBA基本架构
  • IDL文件编写
  • CPP示例实现(上)
  • CPP示例实现(下)
  • C示例实现(IOR+NS上)
  • C示例实现(IOR+NS下)
  • C示例实现(IOR上)
  • C示例实现(IOR下)

要写一个静态绑定的CORBA程序,首先要完成的就是定义接口。CORBA采用的接口描述方式为IDL(Interface Description Language),IDL的语法规则类似于CPP。

IDL与CPP常见类型映射关系如下:

IDL Type C++ Type Word size and range
short CORBA::Short 16 bit: -2^15 … +2^15 – 1
long CORBA::Long 32 bit: -2^31 … +2^31 – 1
long long CORBA::LongLong 64 bit: -2^63 … +2^63 – 1
unsigned short CORBA::UShort 16 bit: 0 … 2^16 – 1
unsigned long CORBA::ULong 32 bit: 0 … 2^32 – 1
unsigned long long CORBA::ULongLong 64 bit: 0 … 2^64
float CORBA::Float 32 bit IEEE single precision floating point number
double CORBA::Double 64 bit IEEE double precision floating point number
long double CORBA::LongDouble
char CORBA::Char 8 bit
wchar CORBA::WChar (Wide Char)
string CORBA::char *
wstring CORBA::WChar *
boolean CORBA::Boolean true/false
octet CORBA::Octet (unsigned char) 8 bit raw. No conversion.
any CORBA::Any Arbitrary

比如,下面就是一个很简单的IDL文件:
hi.idl

module HiCorba
{
	interface Hi
	{
		string sayHiTo(in string someone);
		long add(in long numa, in long numb);
		oneway void shutdown();
	};
};

Leave a Reply

Your email address will not be published. Required fields are marked *

*