Struct definitions

This is a discussion on Struct definitions within the Object forums in Theory and Concepts category; Hi, I have a number of quite large structs that share some fields (both simple and defined types). For now I have written a getter and a setter for each structure and there is like 30 of them. What would be a subtle way to pass any of these structs in a single function call. Defining a BIG struct with all the data would do the trick, but then there would be lots of unnecessary data in each call. Should I use a CORBA::Any instead or is there some better way by using sequences for each type or something like ...

Go Back   Application Development Forum > Theory and Concepts > Object

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 04-02-2004, 06:51 AM
Jarkko Marjeta
Guest
 
Default Struct definitions

Hi,
I have a number of quite large structs that share some fields (both simple
and defined types). For now I have written a getter and a setter for each
structure and there is like 30 of them. What would be a subtle way to pass
any of these structs in a single function call. Defining a BIG struct with
all the data would do the trick, but then there would be lots of unnecessary
data in each call. Should I use a CORBA::Any instead or is there some better
way by using sequences for each type or something like that?
Cheers,
--jarkko


Reply With Quote
  #2  
Old 04-02-2004, 08:45 PM
Ke Jin
Guest
 
Default Re: Struct definitions

"Jarkko Marjeta" <yagge@jippii.fi> wrote in message news:<jtcbc.280$Hp6.175@read3.inet.fi>...
> Hi,
> I have a number of quite large structs that share some fields (both simple
> and defined types). For now I have written a getter and a setter for each
> structure and there is like 30 of them. What would be a subtle way to pass
> any of these structs in a single function call. Defining a BIG struct with
> all the data would do the trick, but then there would be lots of unnecessary
> data in each call. Should I use a CORBA::Any instead or is there some better
> way by using sequences for each type or something like that?


You can also use valuetype.

Regards,
Ke

> Cheers,
> --jarkko

Reply With Quote
  #3  
Old 04-05-2004, 09:10 AM
Michi Henning
Guest
 
Default Re: Struct definitions

"Ke Jin" <kejin@borland.com> wrote in message
news:887a1f78.0404021745.4ce3da16@posting.google.c om...
> "Jarkko Marjeta" <yagge@jippii.fi> wrote in message

news:<jtcbc.280$Hp6.175@read3.inet.fi>...
> > Hi,
> > I have a number of quite large structs that share some fields (both simple
> > and defined types). For now I have written a getter and a setter for each
> > structure and there is like 30 of them. What would be a subtle way to pass
> > any of these structs in a single function call. Defining a BIG struct with
> > all the data would do the trick, but then there would be lots of

unnecessary
> > data in each call. Should I use a CORBA::Any instead or is there some

better
> > way by using sequences for each type or something like that?

>
> You can also use valuetype.


Right, that will work too. But I don't think it would provide anything that
unions
wouldn't, and unions are much more efficient to marshal.

Cheers,

Michi.
--
Michi Henning Ph: +61 4 1118-2700
ZeroC, Inc. http://www.zeroc.com

Reply With Quote
  #4  
Old 04-05-2004, 11:07 PM
Ke Jin
Guest
 
Default Re: Struct definitions

"Michi Henning" <michi@triodia.com> wrote in message news:<6Vccc.670$x7.639@news-server.bigpond.net.au>...
> "Ke Jin" <kejin@borland.com> wrote in message
> news:887a1f78.0404021745.4ce3da16@posting.google.c om...
> > "Jarkko Marjeta" <yagge@jippii.fi> wrote in message

> news:<jtcbc.280$Hp6.175@read3.inet.fi>...
> > > Hi,
> > > I have a number of quite large structs that share some fields (both simple
> > > and defined types). For now I have written a getter and a setter for each
> > > structure and there is like 30 of them. What would be a subtle way to pass
> > > any of these structs in a single function call. Defining a BIG struct with
> > > all the data would do the trick, but then there would be lots of

> unnecessary
> > > data in each call. Should I use a CORBA::Any instead or is there some

> better
> > > way by using sequences for each type or something like that?

> >
> > You can also use valuetype.

>
> Right, that will work too. But I don't think it would provide anything that
> unions
> wouldn't, and unions are much more efficient to marshal.


Yes, agree! I just randomly picked up something I feel better than
pass IDL structures inside Any .

However, with valuetype, it is strightforward to construct and pass a
structure link list (especially a circulated link list). IDL union
doesn't provide such capability.

Also, with 30 or so structures to be IDL'ized, valuetypes allow them
to be defined/maintained/extended independently.

Cheers,
Ke

>
> Cheers,
>
> Michi.

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:01 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.