[omniORB] IDL Linked list
Mayo, Jeff
jeff.mayo at transcore.com
Fri Apr 11 11:30:40 BST 2008
This C-style list has lots of pointers, which don't map well into the
CORBA data representation. Also, it mixes the data contained in the
list (val and str) with the pointers used to implement the list (next,
bar). I recognize that you have an existing code base, but if you
could, you should reimplement your list using the C++ Standard Template
Library. Then you could have a structure to represent your data
independent of your linked list mechanism. That would make conversion
to IDL easier, because . . .
In my opinion, the best way to represent this list is a sequence of
structs that contain the list data, which is to say:
struct data_struct {
int val;
string str;
}
typedef sequence<data_struct> DataList;
Then you will have to write code to translate your C-style list into the
CORBA sequence and back out again.
________________________________
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of David
Sent: Friday, April 11, 2008 7:29 AM
To: Martin Trappel
Cc: omniorb-list at omniorb-support.com
Subject: Re: [omniORB] IDL Linked list
Hi,
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:
class A {
int foo( data_t );
};
typedef struct data_s {
int val;
bar_t *bar;
struct data_s *next;
} data_t;
typedef struct bar_s {
char *str;
} bar_t;
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.
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()?
Am I rambling like a madman? I hope not. Let me know if any of
this makes any sense to you.
/David
On Fri, Apr 11, 2008 at 12:29 PM, Martin Trappel
<0xCDCDCDCD at gmx.at> wrote:
mov . wrote:
Hi,
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,
typedef struct list_item_s {
int value;
struct list_item_s *next;
} list_item_t;
Any ideas? Am I missing something obvious? Any
help is appreciated.
/David
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:
module Example {
interface ListItem;
interface ListItem {
int GetValue();
ListItem Next();
};
};
br,
Martin
More information about the omniORB-list
mailing list