[omniORB] Recursive union IDL

Alex Tingle alex.omniorb at firetree.net
Fri Apr 23 18:19:55 BST 2004


Fred,

Try this:

    // Forward declaration of union.
    union Link;

    typedef sequence<Link> LinkSeq ;

    union Link switch(long) {
      case 0: unsigned short ta;
      case 1: string tb;
      case 2: LinkSeq sc;
    };

-Alex Tingle
    
--

On Fri, 23 Apr 2004 17:59:14 +0200
"Frederic Prin" <frederic.prin at silvaco.com> wrote:
> Hi 
> 
> I'm trying a recursive union:
> 
>     typedef sequence<Link> LinkSeq ;
> 
>     union Link switch(long) {
>     case 0: unsigned short ta;
>     case 1: string tb;
>     case 2: sequence<Link> sc;
>     };
> (from Advanced CORBA Programming with C++ book p 209)
> 
> Omniidl complain:
> Warning: Anonymous sequences for recursive unions are deprecated. Use
> a forward declaration instead.
> 
> But how do I forward declare sequence<Link>  ??
> 
> Off course adding a typedef doesn't work since the Link type is not
> yet known_
> 
> typedef sequence<Link> LinkSeq ;
> 
>     union Link switch(long) {
>     case 0: unsigned short ta;
>     case 1: string tb;
>     case 2: sequence<Link> sc;
>     };
> 
> Something escapes me
> 
> Thanks for hints and maybe a link to an uptodate IDL C++ mapping doc!
> 
> Fred

-- 
:: alex tingle
:: 58 kings way, harrow, mddx. uk. HA1 1XU
:: alex.tingle AT firetree.net  +44-7901-552763 



More information about the omniORB-list mailing list