[omniORB] Nesting IDL files

Gary D. Duzan gdd0@gte.com
Mon, 23 Apr 2001 13:15:14 -0400


In Message <NDBBKOCBNKAGEAJCAHDOKEILCKAA.olaf@tomotherapy.com> ,
   "Olaf Meding" <olaf@tomotherapy.com> wrote:

=>To illustrate:
=>
=>*** abreviated module1.idl ***
=>  module m1 {
=>    // losts of code shared by all of our IDL files
=>
=>    #include "interface1.idl"
=>
=>    #if defined( INTERFACE1_IDL )
=>    #include "interface2.idl"
=>    #endif
=>
=>  }
=>
=>*** abreviated interface1.idl ***
=>  interface i1 {
=>    // interface code
=>  };
=>
=>I do not think that this is a "fragile" approach.  What is the alternative?
=>Put all code into a big IDL file since that are problems splitting code (for
=>a single module) into multiple IDL files?

   If you are using a compiler with namespace support, you'll want
to do it like so:

	*** abreviated module1.idl ***

	  #include "interface1.idl"

	  #if defined( INTERFACE1_IDL )
	  #include "interface2.idl"
	  #endif

	*** abreviated interface1.idl ***
	  module m1 {
	    interface i1 {
	      // interface code
	    };
	  };

	*** abreviated interface2.idl ***
	  module m1 {
	    interface i2 {
	      // interface code
	    };
	  };

This is called reopening modules, which is supported in IDL, but
not practical if modules are mapped to classes instead of namespaces.
If your compiler doesn't support namespaces, then you are pretty much
stuck with one big IDL and some fancy source control footwork.

					Gary Duzan
					Verizon IT