Re: ORBit mail 1 - Multiple-inheritence



David Wragg wrote:
> 
> Here's what my current design looks like:
> 
> For:
> interface A { void m1(); };
> interface B { void m2(); };
> interface C : A, B { void m3(); };
> 
> On the client side, a reference to a C looks like:
> 
>  Object Reference       Object descriptor        Vtables containing
>  (a CORBA_Object)      (an array of void*)        function pointers
> 
>      a_C     -------->  C_vtbl          -------------> m1
>                         void *private                  m3
>                         void *servant
>                         B_vtbl          -----\
>                         void *private         \
>                         void *servant          \-----> m2
> 
> The layount of this vtables handles MI and implicit upcasts, just like
> C++.
> 
> The object descriptor contains pointers to vtables, plus pointers for
> the private use of the ORB, plus pointers to the servant. These are
> repeated to make implicit upcasting work correctly.
> 

I don't understand how implicit upcasting works in this case. Surely to
make this look like an 'a_B' pointer (e.g. to use with B_m2() stub) you
need to adjust the CORBA_Object pointer (i.e. do an explicit cast)? 
(or does the stub function do a search of the vtable for the correct
pointer position?)

Could you show me what your a_B() stub function looks like?


Also, I don't understand how this works (with reference to the above):

/* Produced by IDL compiler: */
void C_m2(CORBA_Object a_C, CORBA_Environment *ev)
{
    void **obj_descr = a_C;

    ((void (*)(void))obj_descr[4][0])(obj_descr[6], ev);
}

Is this meant to be a full implementation of the stub function or just
an illustration?
Whats the row width of obj_descr? It's declared as a void** so my
compiler complains that it doesn't know the length of void* when
attempting to build the double-dereference code.

Sorry for the huge number of questions in this mail, but I'm a bit
clueless at this stage.

Cheers,

Phil.

-- 
_______________________________________________________________________
 Phil Dawes                               |   My opinions are my own
 WWW:    err.. temporarily non-existant   |   and nothing to do with
 Email:  philipd@parallax.co.uk           |      my employer.



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