AW: [omniORB] fixed-length structs

Sean Parker supinlick at yahoo.com
Wed Jul 11 05:49:31 BST 2007


Thanks so much - I'll try it...

  Sean

--- "Fischer, Clemens"
<clemens.fischer at atlas-elektronik.com> wrote:

> Hi,
> 
> the difference in fixed-length and variable-length
> structs is that the former ones are returned by value,
> not by pointer. Yet another of the thousand pitfalls in
> the IDL to C++ mapping.
> 
> In case your get() method is an implemetatation of a
> CORBA interface method, the correct signature would be
> DateTime get( <stuff> ). It's also not necessary to
> create a DateTime instance on the heap. You can simply do
> it like this:
> 
>   DateTime get( <stuff> )
>   {
>     DateTime ret;
>     ret.year = 2007;
>     ...
>     ret.seconds = 0;
>     return ret;
>   }
> 
> So you don't need the _var type at all. I guess it's only
> there for symmetry and in case you later want to make the
> struct variable-length without changing your code.
> 
> If you take a look at _CORBA_ConstrType_Fix_Var, you'll
> notice that it handles its content by value instead of
> pointer and immediately deletes the value passed as
> pointer to its contructor.
> 
> Kind Regards
> Clemens Fischer
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: omniorb-list-bounces at omniorb-support.com
> [mailto:omniorb-list-bounces at omniorb-support.com] Im
> Auftrag von Sean Parker
> Gesendet: Mittwoch, 11. Juli 2007 02:08
> An: omniorb-list at omniorb-support.com
> Betreff: [omniORB] fixed-length structs 
> 
> Hello -
> 
>   I've encountered an issue simply because I'm trying to
> use a struct for the first that is "fixed length" (i.e.
> it's a series of longs, w/o a string in it)
> 
>   For example, I define a struct:
> 
> [Begin IDL]
>   struct DateTime
>   {
>     long year;
>     ...
>     long seconds;
>   };
> [End IDL]
> 
>   This results in C++ template using the *_Fix_* class (I
> forget the exact name) as opposed to the *_Variable_*
> template class if the struct had a string in it.
> 
> [Begin C++]
>   DateTime* get( <stuff> )
>   {
>     DateTime_var ret = new DateTime();
>     ret->year = 2007;
>     ...
>     ret->seconds = 0;
>     return ret._retn();
>   }
> [End C++]
> 
>   Now the compile complains "can't convert DateTime to
> DateTime* in return" on return line.
>  
>  I never had this problem when the template class was for
> variable-length structs. Am I doing something wrong?
> 
>  Any assistance appreciated.
> 
>   Thanks and God Bless
>     Sean
> 
> 
> 
> 
> 
> God Bless 
>     Sean Parker 
> 
> 
> 
> 
> 
>        
>
____________________________________________________________________________________
> Get the free Yahoo! toolbar and rest assured with the
> added security of spyware protection.
>
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
>
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> 





God Bless 
    Sean Parker 





       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/



More information about the omniORB-list mailing list