[omniORB] Arrays as return values without _alloc() everytime?

Duncan Grisby duncan at grisby.org
Mon Mar 1 15:53:38 GMT 2004


On Saturday 28 February, Peter Fischer wrote:

> I have a question about whether it is possible to write a method
> with an array (fixed- or variable- length shouldn't matter to this
> question) as a return value.

Make sure you get your terminology right. Arrays in CORBA are always
fixed length. Variable length things are known as sequences. The
difference most definitely does matter, since the C++ mappings for
arrays and sequences are completely different.

> As far as I have seen this is only portably possible with using the
> method _alloc() and iterating through the whole array (which could
> be huge!) and filling in the values.

For an array, yes.

You should look into sequences. They have methods that allow you to
set and get the contents without copying.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list