class wrapping (was: [omniORB] Date: Wed, 5 Jan 2000 18:46:39 +0300)

Alik Kurdjukov alik@oxiris.net
Fri, 14 Jan 2000 17:50:06 +0300


Hello!

> > Interface A is a wrapper for Class_A. All real implementation is in
Class_A,
> > but I need to have all methods of Class_A implemented in interface A
throu
> > calling to embedded object of Class_A.
>
> [...]
>
> > an so on. But there's no solution of getting CORBA_Impl_A from > object
A_ptr
> > in CORBA_Impl_B::method because of virtual inheretance ;((
> >
> > In this task I don't need any location independance of the > embedding
object
> > like CORBA_Impl_...
>
> If I understand you correctly, your existing application has classes A
> and B. Pointers to instances of class A are passed to instances of
> class B. You wish to wrap A and B in CORBA interfaces, wrap_A and
> wrap_B, but still be able to access the C++ implementation of As which
> are passed to B.

Thats absolutely right.


> The first thing you have to ask yourself is, given that you don't need
> location independence, and you do need to "unwrap" the wrapped CORBA
> object with interface wrap_A, why do you want to use CORBA at all?
> The benefits of CORBA lie in location independence and its uniform
> object model, neither of which you want.

In my project I use CORBA as good and standard object-oriented RPC. I need
to provide to remote client written in Java (or some other language) access
to object model on the server.

> That said, if you really want to get at the implementation object
> associated with an object reference, you will have to use
> dynamic_cast, if your C++ compiler supports it. If you are using
> omniORB 3, you must first call poa->reference_to_servant() on the
> reference, and try to dynamic_cast the result; with omniORB 2, you
> just dynamic_cast the reference itself.

Hmm, I think RTTI usage is bad idea. I made workaround thru creating
system-level hash IOR->Object_Abstract&. Thanks for your help.

Best regards,
Alik.