Re[2]: [omniORB] Reopening namespace - the complete solution

Alex Shabarshoff shura@uc.ru
Fri, 18 Feb 2000 13:46:56 +0300


Hello Duncan,

you wrote:

DG> If you write

DG> module M {
DG>   interface I {};
DG> };

DG> then the repository id of I is IDL:M/I:1.0. However, if you write

DG> // a.idl
DG> module M {
DG> #include "b.idl"
DG> };

DG> // b.idl
DG> interface I {};

DG> then the repository id of I should be IDL:I:1.0. Some IDL compilers
DG> get it wrong, though, and use IDL:M/I:1.0.

Of cause. But the idea was if you have two idl files with _same_
module, you can "shield" the module keyword in defines. Let's look at
more complex example:

A.idl:
#ifndef NAMESPACE_OPENED
#define NAMESPACE_OPENED
#define NAMESPACE_ROOT_A
module M { // here namespace begins
#endif

interface I1 {};

#ifdef NAMESPACE_ROOT_A
}; // here namespace ends
#endif
#endif

B.idl:
#ifndef NAMESPACE_OPENED
#define NAMESPACE_OPENED
#define NAMESPACE_ROOT_B
module M { // here namespace begins
#endif

interface I2 {};

#ifdef NAMESPACE_ROOT_B
}; // here namespace ends
#endif
#endif

So, the repository id's will be IDL:M/I1:1.0 and IDL:M/I2:1.0. I know
this is silly to use defines, but Sun's idl2java gets wild then you
reopen namespace (omniidl2 does not :).

Best regards,
  Alex Shabarshoff (mailto:shura@uc.ru)

Union Card Processing Company
Chief of Security Systems Development Department
Europay Security Supervisor