Re: C++ mapping of OUT variable-length structures
- From: Diego Sevilla Ruiz <dsevilla ditec um es>
- To: ERDI Gergo <cactus cactus rulez org>
- Cc: ORBit/C++ <orbitcpp-list lists sourceforge net>,orbit-list gnome org
- Subject: Re: C++ mapping of OUT variable-length structures
- Date: Wed, 24 Apr 2002 11:20:46 -0500
Hi!
On Wed, Apr 24, 2002 at 04:04:55PM +0200, ERDI Gergo wrote:
| According to a CORBA/C++ spec I've found on the web, the mapping of OUT
| arguments for variable-length structures is T*&. However, I see that there
| are auxillary _out classes in the main ORBit2/C++ branch.
| So my questions are:
| 1, What's the point of these _out classes?
I hope I can explain it well... Please, take a look at H&V book, pages
300-302. The question is that as the _out types are allocated by the
callee, (and are passed by reference), there must be a way to deallocate
the previous owned reference if you use a _var type. That is, the
pointer contained in the call (the value of the T*&) must be 0 (NULL),
so the _out type constructor ensures this for just pointers (for
instance char*) and for _var classes. This is:
1) it frees any memory allocated with the internal _var variable before
calling the method if the actual _var variable is passed as an _out
parameter, and
2) it sets any pointer to null (if not using a _var variable).
| 2, Where should the allocation happen? Should the server allocate
| the structure? Should it be allocated by the client before doing the call?
| Both? Neither?
The structure must be allocated by the implementation code for this
object written by the object implementation programmer.
|
| Right now in my ORBit/C++ branch I'm allocating/deallocating on the client
| side via the new/delete operators, but it would be very easy to modify
| this scheme to do the Right Thing.
In the C++ mapping (contrary to the C mapping) out types are always
allocated by the callee and freed by the caller.
> So what does the CORBA/C++ spec say
| about this?
|
Hope I explained it well...
Best regards.
diego.
--
Diego Sevilla Ruiz http://ditec.um.es/~dsevilla dsevilla@um.es \ /\
Dpto. Ingeniería y Tecnología de Computadores http://ditec.um.es ) ( ')
Visiting Extreme! Computing Lab http://extreme.indiana.edu ( / )
Indiana University, Bloomington http://www.iub.edu \(__)|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]