[omniORB] Problem with sequence

Glenn A. Hochberg gah@research.att.com
Mon, 04 Dec 2000 09:09:11 -0500


You should use the T_var type, i.e.

    Foo::BarList_var bars = foo_ptr->GetBarList ();

You could then follow this with:

   Foo::Bar bar = bars[0];

or you could access the elements directly, e.g.

   CORBA::Long myvar1 = bars[0].var1;

    -Glenn

Mikael Hallendal wrote:

> Hello!
>
> I'm new to this list so I don't know if this has been answered (I rechecked
> the list to 2000-06 and didn't find any though).
>
> If I create an idl with the following in it:
>
> interface Foo {
>         struct Bar {
>                 long  var1;
>                 long  var2;
>         };
>
>         typedef sequence<Bar> BarList;
>
>         BarList GetBarList ();
> };
>
> how do I receive and use the BarList. I've tried:
>
>      Foo::BarList *bars = foo_ptr->GetBarList ();
> and
>      Foo::BarList bars = foo_ptr->GetBarList ();
>      Foo::Bar bar = bars[0];
>
> but it doesn't work: I get compile errors like this:
>
>      foobar.c:X: conversion from `Foo::BarList' to non-scalar type
>     `Foo::Bar' requested
>
> So my question is. How do I use it?
>
> Regards,
> Mikael Hallendal
>
> --
>
> ------------------------------------------------------------------------
> Mikael Hallendal                Email: mikael.hallendal@euroseek.net
> Software Engineer               Phone: +46-8-445 39 60
> Search Engine Development       Fax:   +46-8-628 54 55
> http://www.euroseek.com/        PGP: www.hallendal.net/~micke/mikhal.txt

--
Glenn A. Hochberg     | "Any activity becomes creative when the doer
AT&T Labs             |  cares about doing it right, or doing it better."
gah@research.att.com  |      -John Updike