interfaceの外で定義されたIDL定数がインクルードファイルでC++定数宣言にダイレクトにマッピングされます。コードサンプル20-4~20-5に例を示します。
const string str_example = "this is an example";
const long long_example = 100;
const boolean bool_example = TRUE;
const char * str_example = "this is an example";
const CORBA::Long long_example = 100;
const CORBA::Boolean bool_example = 1;
interfaceの中で定義された定数がインクルードファイルで宣言され,またソースファイルに値が代入されます。コードサンプル20-6~20-8に例を示します。
interface example {
const string str_example = "this is an example";
const long long_example = 100;
const boolean bool_example = TRUE;
};
class example :: public virtual CORBA::Object
{
...
static const char *str_example; /* "this is an example" */
static const CORBA::Long long_example; /* 100 */
static const CORBA::Boolean bool_example; /* 1 */
...
};
const char *example::str_example = "this is an example";
const CORBA::Long example::long_example = 100;
const CORBA::Boolean example::bool_example = 1;