[omniORB] Re: Unions in omniORBpy

Kevin Bailey ke-omniorb@retriever.dyndns.org
Tue, 29 May 2001 16:34:11 -0700


On Tue, May 29, 2001 at 11:01:09AM -0700, Kevin Bailey wrote:
> Given the following union in IDL:
> 
> 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 ?

Here's a little more information. By creating the union like this:

  grilled = Food.Onion(layer=0)
  grilled._d = 0

I can successfully pass the union. The difference is that
grilled._v is 0, not None as it is when passing the union fails.

Interestingly, when I receive this union, _v is set to None.

It looks to me like the parameter marshalling for this kind
of union is wrong. That is, it expects a value regardless of
the discriminator. It doesn't look like the responsible
code (it would appear to be omniPy::alignedsize) can even
determine that a given discriminator can map to no data
so I will have to leave it to someone more knowledgeable
to resolve this.