[omniORB] Problem in marshalling/unmarshalling of discriminated unions

Martin Laporte mlaporte at infovista.com
Wed Jul 28 18:02:10 BST 2004


Hi,

 

There seems to be a problem in the code generated to marshall and unmarshall
discriminated unions. More specifically, the _pd__initialised member's value
is not transmitted, and this causes an exception to be raised when I later
try to change the discriminant value to something else (within the same case
as the previous one, of course).

 

For example, the following IDL :

 

module Test
{
    enum foo
    {
        bill,
        george,
        ronald,
        abraham,
        benjamin
    };

    union bar switch (foo)
    {
        case bill:
        case george:
            double v1;
        case ronald:
            long v2;
        case abraham:
        case benjamin:
            float v3;
    };
    
    interface MyTest
    {
        void something(out bar b);
    };
};



... generates the following code :

 

void
Test::bar::operator>>= (cdrStream& _n) const
{
  _pd__d >>= _n;

  switch(_pd__d) {
    case bill:
      _pd_v1 >>= _n;
    break;
    case george:
      _pd_v1 >>= _n;
    break;
    case ronald:
      _pd_v2 >>= _n;
    break;
    case abraham:
      _pd_v3 >>= _n;
    break;
    case benjamin:
      _pd_v3 >>= _n;
    break;
    default: break;
  }
}



The _pd__initialized member is manifestly not transmitted. Now, if I try the
following code :

 

void testing()
{
    //...
    Test::bar b;
    mytest->something(b); // Sets b's discriminant to bill
    b._d (Test::george); // throws an exception because _pd__initialized not
set!
}



I get an exception.

 

Is there something I didn't understood?

 

Thanks in advance!

 

Martin

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20040728/aaa1cab8/attachment.htm


More information about the omniORB-list mailing list