Re: ORBit mail 2 - MI Upcasting




Phil Dawes <philipd@parallax.co.uk> writes:
> A good strategy for overcoming this obstacle is to add another layer
> of indirection by making CORBA_Object a smart-pointer structure. This
> holds a pointer to the current vtable, and a pointer to the raw object
> structure:
> 
> 
> struct CORBA_Object_Ptr
> {
>     gpointer vtable;
>     raw_CORBA_Object obj;
> };
> 
> typedef CORBA_Object_Ptr CORBA_Object;

IMHO, this is unacceptable - it would represent a significant
violation of the CORBA C mapping spec, and if you're not worried about
implementing the CORBA C mapping then there are much easier ways to
achieve the objectives, as I'm sure you're aware.

See my response to your "part 1" for what is, IMHO, a better solution.

Chapter and verse: CORBA v2.2 spec, ch. 19, page 7.

    All object references ([...]) are of the well-known opaque type
    CORBA_Object. The representation of CORBA_Object is a pointer.

So you should be able to cast CORBA_Object to void*, and back, within
the confines of the C standard.

(Actually, if all references are actually the same type, then it seems
to me that pointer has to be a void*.)

--
Dave Wragg



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]