Discussion:
[omniORB] Usage of _out objects
Bjørn Kristian Larsen
2007-08-12 21:00:15 UTC
Permalink
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...
Gerd Schmitt
2007-08-13 14:40:55 UTC
Permalink
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;
Post by Bjørn Kristian Larsen
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
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
***@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

***@it-studio.de
www.it-studio.de

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