[omniORB] Dereferencing _vars

Bruce Fountain B_Fountain@motherwell.com.au
Fri, 8 Jun 2001 00:58:54 +0800


One last one before I turn in...

I don't seem to be able to deference an _var in the same way I
could with other ORBs. For instance, if I have the following IDL:

interface foo
{
   struct nv
   {
      string name;
      string value;
   };

   typedef sequence<nv> nvseq;

   nvseq getNvSeq();
};

Then I would normally use getNvSeq() something like this:

   foo::nvseq_var nvs = myFoo->getNvSeq();
   for (int i = 0; i < nvs->length(); i++)
   {
      cout << "name = " << (*nvs)[i].name.in() << "\n";
      cout << "value = " << (*nvs)[i].value.in() << "\n";
   }

but omniORB won't let me dereference (*result). I can introduce a
new variable which is a pointer and dereference that:
   foo::nvseq_var nvs = myFoo->getNvSeq();
   const foo:nvseq* ptr = nvs.in();
   for (int i = 0; i < ptr->length(); i++)
   {
      cout << "name = " << (*ptr)[i].name.in() << "\n";
      cout << "value = " << (*ptr)[i].value.in() << "\n";
   }

... bit ugly though. There is probably a really simple, elegant
trick, right?

Bruce Fountain
Mi Consulting Group (Australia) Pty Ltd
Direct Line:  +61 (0)8 9368 8607
Switchboard:  +61 (0)8 9368 8600
Facsimile:    +61 (0)8 9368 8699
E-mail: b_fountain@motherwell.com.au