[omniORB] Usage of _out objects

Gerd Schmitt extern.schmitt at kmweg.de
Mon Aug 13 11:40:28 BST 2007


Hi Bjørn,

the default response: get a good book about CORBA, like
Advanced CORBA Programming with C++ by Henning and Vinoski.

I give you an example of handling a string:

void Server::f( CORBA::String_out result )
{
   result = CORBA::string_dup( "Hello, world!" );
}

Here you see, that new memory is allocated which is later on freed
by CORBA (after it has been sent).

hth,
   Gerd

P.S.: A reference to a pointer is something like in here:
foo( char*& result ) // without the "&" result won't be changed for the caller
{
   result = new char[20];
   // ... put something in the string...
}
This is necessary, if foo allocates memory and points result to it.
This way the caller may free the memory by using the pointer:
char* bar;
foo(bar);
delete [] bar;



Bjørn Kristian Larsen wrote:
> Say you are calling this function from the client (c++):
> 
> void Server::f(A_out a){
> ...
> }
> 
> How do you set the A_out (variable length) object?
> 
> My book says it's a "reference to a pointer". I'm not sure what that is 
> and not how to handle them.
> 
> And if I understand my book correct, I don't need to free/release the 
> object on the server (callee) side. Is this correct?
> 
> 
> Sorry for the stupid question, but I'm new to CORBA...
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> 


-- 

Gerd Schmitt
externer Dienstleister der
     Krauss-Maffei Wegmann GmbH & Co. KG
     Krauss-Maffei-Str. 11
     80997 München
     Tel: +49/89/8140.4877
     extern.schmitt at kmweg.de

---------------------------------------

IT-Studio GmbH
Zugspitzstraße 23, D-82223 Eichenau

Fon: +49 (0) 8141-537 20 84
Fax: +49 (0) 8141-537 20 99

gschmitt at it-studio.de
www.it-studio.de

---------------------------------------
A triangle was a big improvement over the square wheel: it eliminated one bump.




More information about the omniORB-list mailing list