<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4630.0">
<TITLE>Recursive union IDL </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I'm trying a recursive union:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> typedef sequence<Link> LinkSeq ;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> union Link switch(long) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 0: unsigned short ta;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 1: string tb;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 2: sequence<Link> sc;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> };</FONT>
<BR><FONT SIZE=2 FACE="Arial">(from Advanced CORBA Programming with C++ book p 209)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Omniidl complain:</FONT>
<BR><FONT SIZE=2 FACE="Arial">Warning: Anonymous sequences for recursive unions are deprecated. Use a forward declaration instead.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">But how do I forward declare sequence<Link> ??</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Off course adding a typedef doesn't work since the Link type is not yet known…</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">typedef sequence<Link> LinkSeq ;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> union Link switch(long) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 0: unsigned short ta;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 1: string tb;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> case 2: sequence<Link> sc;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> };</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Something escapes me</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thanks for hints and maybe a link to an uptodate IDL C++ mapping doc!</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Fred</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New"> (</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> <B></B></FONT><B> <FONT FACE="Courier New">Frédéric Prin</FONT></B><FONT SIZE=2 FACE="Courier New"> )</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Senior Software Engineer /</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> S I L V A C O (</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Grenoble REsearch CEnter \</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Tel 04 56 38 10 33 )</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> __________________________/___</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/__/__/</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/_____/</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/__/__/</FONT>
</P>
</BODY>
</HTML>