[omniORB] function and sequence

DA SILVA Antonio adasilva at carax.com
Thu Jan 31 15:05:23 GMT 2008


>...temp-destructor, so we would have nothing valid to return. Are there any other
>ways except "._retn();" here ?

I think there is no other way, in fact the "retn( )" detach the internal
pointer from the "var" reference-counting-pointer
and return it to the caller, the caller has the reponsability to destroy
the object.

Antonio.

evgeni.rojkov at durr.com a écrit :
>> You can use also for the strings :
>> temp[0] = ( const char * )"klaus at uni.de";
>>     
>
> Yes, both operator=(const char*) and CORBA::string_dup() will work correctly
> here. I would prefer CORBA::string_dup() to avoid disaster if "const" is missing
> and just "char*" used. 
>
>   
>> Evgeni, what about reference counting
>> with the "_retn( )"?
>>     
>
> Here is the code we are talking about:
> {
>  Feld_var temp = new Feld;
>  ....
>  return temp._retn();
> }
> Immediately after "return ...;" temp goes out of scope.
> Without "temp._retn();", "delete temp.pd_data;" will be called in
> temp-destructor, so we would have nothing valid to return. Are there any other
> ways except "._retn();" here ?
>
> Kind Regards, 
> Evgeni
>
>
> -----Ursprüngliche Nachricht-----
> Von: omniorb-list-bounces at omniorb-support.com
> [mailto:omniorb-list-bounces at omniorb-support.com] Im Auftrag von DA SILVA
> Antonio
> Gesendet: Mittwoch, 30. Januar 2008 17:34
> An: omniorb-list at omniorb-support.com
> Betreff: Re: [omniORB] function and sequence
>
>
>
>
> Hi Ronald,
>
> You can use also for the strings :
> temp[0] = ( const char * )"klaus at uni.de";
>
> Evgni, what about reference counting
> with the "_retn( )"?
>
> Antonio.
>
>
> Ronald Andrae a écrit :
>   
>> Hello,
>>
>> thanks, you have fixed my problem. :-)
>>
>> evgeni.rojkov at durr.com schrieb:
>>     
>>> Here are 2 improvement suggestions.
>>> Regards, Evgeni
>>>
>>> // 1.
>>> // temp[0] = "klaus at uni.de";   
>>> temp[0] = CORBA::string_dup("klaus at uni.de");
>>>
>>> // 2.
>>> //return temp;
>>> return temp._retn();
>>>
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: omniorb-list-bounces at omniorb-support.com
>>> [mailto:omniorb-list-bounces at omniorb-support.com] Im Auftrag von 
>>> Ronald Andrae
>>> Gesendet: Mittwoch, 30. Januar 2008 15:16
>>> An: omniorb-list at omniorb-support.com
>>> Betreff: [omniORB] function and sequence
>>>
>>>
>>> Hello,
>>>
>>> I have function, which returns a variable array (sequence).
>>>
>>> My IDL:
>>>
>>> typedef sequence<string> Feld;
>>>
>>> interface Student{
>>>     Feld getEmails();
>>> };
>>>
>>> My implementation:
>>>
>>> class Student_impl :  public POA_Student
>>> {
>>> public:
>>>
>>>     Feld * getEmails() {
>>>         Feld_var temp = new Feld;
>>>         temp->length(3);
>>>         temp[0] = "klaus at uni.de";
>>>         temp[1] = "gustav at uni.de";
>>>         temp[2] = "dieter at uni.de";
>>>         return temp;
>>>     }
>>> };
>>>
>>> There is a problem with the types Feld and Feld_var. Have anyone an 
>>> idea, how i can fix this problem, so that I can use the array at the 
>>> client side?
>>>
>>> Thanks
>>>
>>> _______________________________________________
>>> omniORB-list mailing list
>>> omniORB-list at omniorb-support.com 
>>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>>>
>>>   
>>>       
>> _______________________________________________
>> omniORB-list mailing list
>> omniORB-list at omniorb-support.com 
>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>>
>>     
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
>
>   

-- 
_________________________
Antonio DA SILVA
C A R A X   IT Department
Software Engineer
11 bis rue d'Aguesseau
75008 Paris, FRANCE
Tel +33 (0)1 70 91 67 94
_________________________




More information about the omniORB-list mailing list