[omniORB] Unions in omniORBpy

Duncan Grisby dgrisby@uk.research.att.com
Wed, 30 May 2001 10:06:37 +0100


On Tuesday 29 May, Kevin Bailey wrote:

> module Food
> {
> union Onion switch(boolean)
> {
>   case TRUE:
>     long layer;
> };
> };
> 
> what is the proper way to create an Onion with the discriminator
> set to false ?

Since there isn't a member name to set, you can't use the keyword
argument constructor form. You have to use the constructor which takes
the discriminator and value:

  a = Food.Onion(1, 1234)  # _d = true,  _v = 1234
  b = Food.Onion(0, None)  # _d = false, _v = None

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --