<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>The
linked list won't work - IDL does not allow forward declaration of
structures. As other have mentioned, you can implement it as an array or
as an object that iterates through the list on the server side. If you're
really concerned about performance, you can implement it as a mix of the
two - the method returns an array of the first n items in the list, and a
reference to an iterator to retrieve the next batch of objects.
(CosNaming::NamingContext::list() is an example of this).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>Pointers - most CORBA implementations do not allow you
to use NULLs, so if you need to check if somethiing is present, your need to do
a discriminator union, i.e.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>
union bar_t switch(boolean)<BR> {<BR> case TRUE: string
str;<BR> };<BR> <BR> struct data_t<BR>
{<BR> long val;<BR> bar_t bar;<BR>
};<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>Populating it would look something like
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>char*
stringValue;</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>data_t
data;</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>...</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>if(stringValue==NULL){</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>
data.bar._default(); //sets the discriminator to
FALSE</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>}</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>else{</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>
data.bar.str(stringValue); //sets the discriminator to TRUE,
and populates the </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>}</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>To
check the value:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV><FONT face=Arial
color=#0000ff size=2><SPAN class=443351115-11042008>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>const
char* stringValue;</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>data_t
data;</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008>...</SPAN></FONT></DIV>
<DIV>if(data.bar._d()==1){<BR> stringValue=data.bar.str();</DIV>
<DIV>}<BR>else{<BR> stringValue=NULL;<BR>}</DIV></SPAN></FONT>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=443351115-11042008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=443351115-11042008>One
thing to watch for - there are a couple of CORBA implementations out there that
don't handle this properly, so if you're planning on using this with multiple
implementations, test them before moving forward with
everything.</DIV></SPAN></FONT>
<DIV><FONT face=Tahoma><FONT size=2><SPAN class=443351115-11042008><FONT
face=Arial color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Tahoma><FONT size=2><SPAN
class=443351115-11042008></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Tahoma><FONT size=2><SPAN
class=443351115-11042008> </SPAN>-----Original Message-----<BR><B>From:</B>
omniorb-list-bounces@omniorb-support.com
[mailto:omniorb-list-bounces@omniorb-support.com] <B>On Behalf Of
</B>David<BR><B>Sent:</B> Friday, April 11, 2008 7:29 AM<BR><B>To:</B> Martin
Trappel<BR><B>Cc:</B> omniorb-list@omniorb-support.com<BR><B>Subject:</B> Re:
[omniORB] IDL Linked list<BR><BR></DIV></FONT></FONT>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">Hi,<BR><BR>Great, thanks. Maybe I'm not
going about solving my problem in the right way though. I have a C++ scenario
which looks something like this:<BR><BR>class A {<BR> int foo( data_t
);<BR>};<BR><BR>typedef struct data_s {<BR> int val;<BR> bar_t
*bar;<BR> struct data_s *next;<BR>} data_t;<BR><BR>typedef struct bar_s
{<BR> char *str;<BR>} bar_t;<BR><BR>I need to make A accessible via
CORBA. That is, another machine, where the data_t and bar_t structs reside,
should be able to call a.foo(). The data_t and bar_t arguments need to be sent
over the network. I'm not sure how the bar pointer in data_t will be handled
though -- do I need to get rid of it? I want to minimize the amount of object
passing needed.<BR><BR>Note that this is a modification of an existing
codebase. I want to integrate CORBA into this as little as possible, but if
CORBA is going to send the arguments, it needs to know what they look like,
right? Would an alternative be to "serialize" the data_t struct (not
necessarily into a stream/string, but just something that CORBA handles well),
send it over the network to an AProxy object, which would "deserialize" the
data_t struct and call a.foo()?<BR><BR>Am I rambling like a madman? I hope
not. Let me know if any of this makes any sense to
you.<BR><BR>/David<BR><BR><BR>
<DIV class=gmail_quote>On Fri, Apr 11, 2008 at 12:29 PM, Martin Trappel <<A
href="mailto:0xCDCDCDCD@gmx.at">0xCDCDCDCD@gmx.at</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>mov . wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi,<BR><BR>I've
googled a fair amount, and found nothing on the mailing list about this.
How would I model a linked list in IDL? Could someone maybe point me to
some good IDL documentation for omniORB, if there is any. I've looked at
the C++ Language Mapping, Version 1.2 from OMG, but I haven't found
anything there either. What I want is something that's equivalent to, and
preferably also maps to,<BR><BR>typedef struct list_item_s {<BR> int
value;<BR> struct list_item_s *next;<BR>} list_item_t;<BR><BR>Any
ideas? Am I missing something obvious? Any help is
appreciated.<BR><BR>/David<BR><BR></BLOCKQUOTE><BR></DIV></DIV>IDL only
defines an Interface, so it may not make sense to define a linked list in
IDL. Of course, if you really like to model a linked list on the interface
level, you could write something like:<BR><BR>module Example
{<BR> interface ListItem;<BR><BR> interface ListItem {<BR>
int GetValue();<BR> ListItem
Next();<BR> };<BR>};<BR><BR>br,<BR><FONT
color=#888888>Martin<BR></FONT></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>