[omniORB] idl and structs

Mike Olson Mike.Olson@FourThought.com
Tue, 10 Apr 2001 07:18:33 -0600


David Hyde wrote:
> 
> I've just noticed, to my horror, that IDL structs cannot inherit from each
> other (I'm busy converting an interface from a proprietary language where
> complex structures have been built up using inheritance).  Is there a
> specific reason for this?  Has anyone fudged their way around this?

I've gotten around this before with Unions

enum TYPE {
  A_TYPE,
  B_TYPE
};

struct A {
  attribute foo;
};

struct B {
  attribute bar;
};

union CommonUnion switch(TYPE) {
  case A_TYPE: A athing;
  case B_TYPE: B bthing;
};

struct Common {
  CommonUnion commonData;
  attribute otherData;
};



Its not as easy to work with as inheritence, but it gets across the same
data.  Also, because I mostly use Python as a client, I change what is
instantiated on the client side so that it is a proper inheritence tree.

Mike

> 
> Thanks
> 
> David
> 
> ________________________________________________________
> David Hyde
> The Cavendish Organisation Ltd.
> Admiral House
> St. Leonards Rd                         Tel: +44 1753 836600
> Windsor                                 Fax: +44 1753 855021
> Berkshire SL4 3BL
> United Kingdom
> 
> email: davidh@cavendish.co.uk
> 
> http://www.cavendish.co.uk/
> 
> Confidential Information may be in this message. If you are not the intended
> addressee please treat it as confidential, contact us immediately. Thank
> you.
> ______________________________________________________________

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python